File: test.erb

package info (click to toggle)
web-mode 17.3.20-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,164 kB
  • sloc: lisp: 13,359; javascript: 506; jsp: 113; sh: 10; php: 9; makefile: 8; xml: 2
file content (134 lines) | stat: -rw-r--r-- 2,015 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<% unless @starred_stories.empty? %>
  <% if @starred_stories.total_pages > 1 %>
    <%= render_js :stories, { stories: @starred_stories } %>
  <% end %>
<% end %>

<div>
  <%= mail_to("",
              "Email to a friend",
              :subject => @listing.display_title,
              body: "I found this listing online, and thought you might be interested:\n#{@listing.url}",
              :class => 'mail') %>
</div>

<div>
  <%= render partial: 'some_partial',
             locals: {
               icon: nil,
               errors: [],
               title: 'Title'
             }
  %>
</div>

<div>
  <div>
    <%
    a = [
      [1, 2],
      [3, 4]
    ]
    b = 10
    %>
  </div>
</div>

<div id='header'>
  <% if signed_in? -%>
    <%= link_to t('.sign_out'), sign_out_path, :method => :delete %>
  <% else -%>
    <%= link_to t('.sign_in'), sign_in_path %>
  <% end -%>
</div>

<div id='flash'>
  <% flash.each do |key, value| -%>
    <div id='flash_<%= key %>'><%=h value %></div>
  <% end %>
</div>

<div>
  <% if request.xhr? %>
    <span></span>
  <% end %>
</div>


<%
if foo
  puts "foo"
  puts "foo"


  puts "foo"
  puts "foo"
end

$age =  5
case $age
when 0 .. 2
  puts "baby"
when 3 .. 6
  puts "little child"
when 7 .. 12
  puts "child"
when 13 .. 18
  puts "youth"
else
  puts "adult"
end

class Greeter

  def initialize(name = "World")
    @name = name
  end

  def say_hi
    puts "Hi #{@name}!"
  end

  def say_bye
    puts "Bye #{@name}, come back soon."
  end

end

x=1
if x > 2
  puts "x is greater than 2"
elsif x <= 2 and x!=0
  puts "x is 1"
else
  puts "I can't guess the number"
end

%>

<% if request.xhr? %>
  <div class="reloadable"></div>
<% end %>


<div>
  <% if request.xhr? %>
    <span></span>
  <% else %>
    <p></p>
  <% end %>
</div>

<% @hash.each do |t, a| %>
  <h2><%= t %></h2>
  <% a.each do |q| %>
    <%= link_to(q.question_answers_url) %>  </br>
  <% end %>
<% end %>


<ul>
  <% for @item in @shopping_list %>
    <li><%= @item %></li>
  <% end %>
</ul>