merb-admin 0.8.1 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +29 -27
- data/Gemfile +24 -22
- data/Gemfile.lock +86 -0
- data/LICENSE +20 -20
- data/README.rdoc +54 -58
- data/Rakefile +11 -44
- data/app/controllers/application.rb +6 -6
- data/app/controllers/main.rb +191 -191
- data/app/helpers/application_helper.rb +64 -64
- data/app/helpers/main_helper.rb +167 -167
- data/app/models/.gitkeep +0 -0
- data/app/views/layout/_message.html.erb +10 -10
- data/app/views/layout/dashboard.html.erb +34 -34
- data/app/views/layout/form.html.erb +48 -48
- data/app/views/layout/list.html.erb +42 -42
- data/app/views/main/_belongs_to.html.erb +29 -29
- data/app/views/main/_big_decimal.html.erb +12 -12
- data/app/views/main/_boolean.html.erb +7 -7
- data/app/views/main/_date.html.erb +12 -12
- data/app/views/main/_datetime.html.erb +12 -12
- data/app/views/main/_float.html.erb +12 -12
- data/app/views/main/_has_many.html.erb +16 -16
- data/app/views/main/_has_one.html.erb +30 -30
- data/app/views/main/_integer.html.erb +12 -12
- data/app/views/main/_properties.html.erb +18 -18
- data/app/views/main/_string.html.erb +15 -15
- data/app/views/main/_text.html.erb +11 -11
- data/app/views/main/_time.html.erb +12 -12
- data/app/views/main/_timestamp.html.erb +12 -12
- data/app/views/main/delete.html.erb +28 -28
- data/app/views/main/edit.html.erb +19 -19
- data/app/views/main/index.html.erb +22 -22
- data/app/views/main/list.html.erb +93 -93
- data/app/views/main/new.html.erb +16 -16
- data/config/init.rb +30 -0
- data/config/router.rb +4 -0
- data/lib/abstract_model.rb +84 -86
- data/lib/active_record_support.rb +147 -147
- data/lib/datamapper_support.rb +139 -140
- data/lib/generic_support.rb +13 -13
- data/lib/merb-admin.rb +99 -99
- data/lib/merb-admin/merbtasks.rb +103 -103
- data/lib/merb-admin/slicetasks.rb +174 -174
- data/lib/merb-admin/spectasks.rb +55 -55
- data/lib/merb-admin/version.rb +3 -0
- data/lib/sequel_support.rb +275 -275
- data/merb-admin.gemspec +42 -232
- data/public/javascripts/CollapsedFieldsets.js +85 -85
- data/public/javascripts/DateTimeShortcuts.js +255 -255
- data/public/javascripts/RelatedObjectLookups.js +96 -96
- data/public/javascripts/SelectBox.js +111 -111
- data/public/javascripts/SelectFilter2.js +113 -113
- data/public/javascripts/actions.js +39 -39
- data/public/javascripts/calendar.js +143 -143
- data/public/javascripts/core.js +176 -176
- data/public/javascripts/dateparse.js +233 -233
- data/public/javascripts/getElementsBySelector.js +167 -167
- data/public/javascripts/i18n.js +33 -33
- data/public/javascripts/ordering.js +137 -137
- data/public/javascripts/timeparse.js +94 -94
- data/public/javascripts/urlify.js +140 -140
- data/public/stylesheets/base.css +746 -746
- data/public/stylesheets/changelists.css +269 -269
- data/public/stylesheets/dashboard.css +24 -24
- data/public/stylesheets/forms.css +327 -327
- data/public/stylesheets/global.css +142 -142
- data/public/stylesheets/ie.css +50 -50
- data/public/stylesheets/layout.css +29 -29
- data/public/stylesheets/login.css +54 -54
- data/public/stylesheets/master.css +1 -1
- data/public/stylesheets/patch-iewin.css +7 -7
- data/public/stylesheets/rtl.css +206 -206
- data/public/stylesheets/widgets.css +506 -506
- data/screenshots/create.png +0 -0
- data/screenshots/delete.png +0 -0
- data/screenshots/edit.png +0 -0
- data/screenshots/index.png +0 -0
- data/screenshots/list.png +0 -0
- data/screenshots/new.png +0 -0
- data/spec/controllers/main_spec.rb +25 -25
- data/spec/migrations/activerecord/001_create_divisions_migration.rb +13 -13
- data/spec/migrations/activerecord/002_create_drafts_migration.rb +19 -19
- data/spec/migrations/activerecord/003_create_leagues_migration.rb +12 -12
- data/spec/migrations/activerecord/004_create_players_migration.rb +19 -20
- data/spec/migrations/activerecord/005_create_teams_migration.rb +22 -22
- data/spec/migrations/sequel/001_create_divisions_migration.rb +15 -15
- data/spec/migrations/sequel/002_create_drafts_migration.rb +21 -21
- data/spec/migrations/sequel/003_create_leagues_migration.rb +14 -14
- data/spec/migrations/sequel/004_create_players_migration.rb +21 -22
- data/spec/migrations/sequel/005_create_teams_migration.rb +24 -24
- data/spec/models/activerecord/division.rb +7 -7
- data/spec/models/activerecord/draft.rb +11 -11
- data/spec/models/activerecord/league.rb +6 -6
- data/spec/models/activerecord/player.rb +8 -8
- data/spec/models/activerecord/team.rb +13 -13
- data/spec/models/datamapper/division.rb +12 -12
- data/spec/models/datamapper/draft.rb +18 -18
- data/spec/models/datamapper/league.rb +11 -11
- data/spec/models/datamapper/player.rb +20 -21
- data/spec/models/datamapper/team.rb +22 -22
- data/spec/models/sequel/division.rb +15 -15
- data/spec/models/sequel/draft.rb +19 -19
- data/spec/models/sequel/league.rb +14 -14
- data/spec/models/sequel/player.rb +18 -18
- data/spec/models/sequel/team.rb +21 -21
- data/spec/requests/main_spec.rb +763 -763
- data/spec/spec_helper.rb +113 -112
- metadata +247 -41
- data/VERSION +0 -1
@@ -1,16 +1,16 @@
|
|
1
|
-
<%
|
2
|
-
association_name = association[:name]
|
3
|
-
collection = MerbAdmin::AbstractModel.new(association[:child_model]).all.map{|object| [object.id, object_label(object)]}.sort_by{|object| object[1]}
|
4
|
-
selected = @object.send(association_name)
|
5
|
-
label = association[:pretty_name]
|
6
|
-
%>
|
7
|
-
<fieldset class="module aligned">
|
8
|
-
<h2><%= label %></h2>
|
9
|
-
<div class="form-row">
|
10
|
-
<div>
|
11
|
-
<%= select(:name => "associations[#{association_name}][]", :id => association_name, :collection => collection, :selected => selected.map{|o| o.id.to_s}, :label => label, :multiple => true) %>
|
12
|
-
<script type="text/javascript">addEvent(window, "load", function(e) {SelectFilter.init("<%= association_name %>", "<%= association_name %>", 0, "<%= image_path %>"); });</script>
|
13
|
-
<p class="help">Hold down "Control", or "Command" on a Mac, to select more than one.</p>
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
</fieldset>
|
1
|
+
<%
|
2
|
+
association_name = association[:name]
|
3
|
+
collection = MerbAdmin::AbstractModel.new(association[:child_model]).all.map{|object| [object.id, object_label(object)]}.sort_by{|object| object[1]}
|
4
|
+
selected = @object.send(association_name)
|
5
|
+
label = association[:pretty_name]
|
6
|
+
%>
|
7
|
+
<fieldset class="module aligned">
|
8
|
+
<h2><%= label %></h2>
|
9
|
+
<div class="form-row">
|
10
|
+
<div>
|
11
|
+
<%= select(:name => "associations[#{association_name}][]", :id => association_name, :collection => collection, :selected => selected.map{|o| o.id.to_s}, :label => label, :multiple => true) %>
|
12
|
+
<script type="text/javascript">addEvent(window, "load", function(e) {SelectFilter.init("<%= association_name %>", "<%= association_name %>", 0, "<%= image_path %>"); });</script>
|
13
|
+
<p class="help">Hold down "Control", or "Command" on a Mac, to select more than one.</p>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</fieldset>
|
@@ -1,30 +1,30 @@
|
|
1
|
-
<%
|
2
|
-
child_key = association[:child_key].first
|
3
|
-
association_name = association[:name]
|
4
|
-
collection = MerbAdmin::AbstractModel.new(association[:child_model]).all.map{|object| [object.id, object_label(object)]}.sort_by{|object| object[1]}
|
5
|
-
selected = @object.send(association_name)
|
6
|
-
label = association[:pretty_name]
|
7
|
-
required = false
|
8
|
-
errors_exist = !(@object.errors[child_key].nil? || @object.errors[child_key].empty?)
|
9
|
-
@properties.select{|property| property[:name] == child_key}.each do |property|
|
10
|
-
required = true unless property[:nullable?]
|
11
|
-
end
|
12
|
-
%>
|
13
|
-
<fieldset class="module aligned">
|
14
|
-
<h2><%= label %></h2>
|
15
|
-
<div class="<%= errors_exist ? "form-row errors" : "form-row" %>">
|
16
|
-
<% if errors_exist %>
|
17
|
-
<ul class="errorlist">
|
18
|
-
<% @object.errors[child_key].each do |error| %>
|
19
|
-
<li><%= error %></li>
|
20
|
-
<% end %>
|
21
|
-
</ul>
|
22
|
-
<% end %>
|
23
|
-
<div>
|
24
|
-
<%= select(:name => "associations[#{association_name}][]", :id => association_name, :collection => collection, :include_blank => true, :selected => selected ? selected.id.to_s : nil, :label => label) %>
|
25
|
-
<p class="help">
|
26
|
-
<%= required ? "Required." : "Optional." %>
|
27
|
-
</p>
|
28
|
-
</div>
|
29
|
-
</div>
|
30
|
-
</fieldset>
|
1
|
+
<%
|
2
|
+
child_key = association[:child_key].first
|
3
|
+
association_name = association[:name]
|
4
|
+
collection = MerbAdmin::AbstractModel.new(association[:child_model]).all.map{|object| [object.id, object_label(object)]}.sort_by{|object| object[1]}
|
5
|
+
selected = @object.send(association_name)
|
6
|
+
label = association[:pretty_name]
|
7
|
+
required = false
|
8
|
+
errors_exist = !(@object.errors[child_key].nil? || @object.errors[child_key].empty?)
|
9
|
+
@properties.select{|property| property[:name] == child_key}.each do |property|
|
10
|
+
required = true unless property[:nullable?]
|
11
|
+
end
|
12
|
+
%>
|
13
|
+
<fieldset class="module aligned">
|
14
|
+
<h2><%= label %></h2>
|
15
|
+
<div class="<%= errors_exist ? "form-row errors" : "form-row" %>">
|
16
|
+
<% if errors_exist %>
|
17
|
+
<ul class="errorlist">
|
18
|
+
<% @object.errors[child_key].each do |error| %>
|
19
|
+
<li><%= error %></li>
|
20
|
+
<% end %>
|
21
|
+
</ul>
|
22
|
+
<% end %>
|
23
|
+
<div>
|
24
|
+
<%= select(:name => "associations[#{association_name}][]", :id => association_name, :collection => collection, :include_blank => true, :selected => selected ? selected.id.to_s : nil, :label => label) %>
|
25
|
+
<p class="help">
|
26
|
+
<%= required ? "Required." : "Optional." %>
|
27
|
+
</p>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</fieldset>
|
@@ -1,12 +1,12 @@
|
|
1
|
-
<%
|
2
|
-
property_name = property[:name]
|
3
|
-
length = property[:length]
|
4
|
-
label = property[:pretty_name]
|
5
|
-
required = !property[:nullable?] || property[:serial?]
|
6
|
-
%>
|
7
|
-
<div>
|
8
|
-
<%= text_field(property_name, :maxlength => length, :label => label) %>
|
9
|
-
<p class="help">
|
10
|
-
<%= required ? "Required." : "Optional." %>
|
11
|
-
</p>
|
12
|
-
</div>
|
1
|
+
<%
|
2
|
+
property_name = property[:name]
|
3
|
+
length = property[:length].to_i
|
4
|
+
label = property[:pretty_name]
|
5
|
+
required = !property[:nullable?] || property[:serial?]
|
6
|
+
%>
|
7
|
+
<div>
|
8
|
+
<%= text_field(property_name, :maxlength => length, :label => label) %>
|
9
|
+
<p class="help">
|
10
|
+
<%= required ? "Required." : "Optional." %>
|
11
|
+
</p>
|
12
|
+
</div>
|
@@ -1,18 +1,18 @@
|
|
1
|
-
<fieldset class="module aligned">
|
2
|
-
<% belongs_to_keys = @abstract_model.belongs_to_associations.map{|b| b[:child_key].first} %>
|
3
|
-
<% properties.reject{|property| [:id, :created_at, :created_on, :deleted_at, :updated_at, :updated_on, :deleted_on].include?(property[:name]) || belongs_to_keys.include?(property[:name])}.each do |property| %>
|
4
|
-
<% property_name = property[:name] %>
|
5
|
-
<% property_type = property[:type] %>
|
6
|
-
<% errors_exist = !(@object.errors[property_name].nil? || @object.errors[property_name].empty?) %>
|
7
|
-
<div class="<%= errors_exist ? "form-row errors" : "form-row" %>">
|
8
|
-
<% if errors_exist %>
|
9
|
-
<ul class="errorlist">
|
10
|
-
<% @object.errors[property_name].each do |error| %>
|
11
|
-
<li><%= error %></li>
|
12
|
-
<% end %>
|
13
|
-
</ul>
|
14
|
-
<% end %>
|
15
|
-
<%= partial(property_type.to_s, :property => property) -%>
|
16
|
-
</div>
|
17
|
-
<% end %>
|
18
|
-
</fieldset>
|
1
|
+
<fieldset class="module aligned">
|
2
|
+
<% belongs_to_keys = @abstract_model.belongs_to_associations.map{|b| b[:child_key].first} %>
|
3
|
+
<% properties.reject{|property| [:id, :created_at, :created_on, :deleted_at, :updated_at, :updated_on, :deleted_on].include?(property[:name]) || belongs_to_keys.include?(property[:name])}.each do |property| %>
|
4
|
+
<% property_name = property[:name] %>
|
5
|
+
<% property_type = property[:type] %>
|
6
|
+
<% errors_exist = !(@object.errors[property_name].nil? || @object.errors[property_name].empty?) %>
|
7
|
+
<div class="<%= errors_exist ? "form-row errors" : "form-row" %>">
|
8
|
+
<% if errors_exist %>
|
9
|
+
<ul class="errorlist">
|
10
|
+
<% @object.errors[property_name].each do |error| %>
|
11
|
+
<li><%= error %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
<% end %>
|
15
|
+
<%= partial(property_type.to_s, :property => property) -%>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
</fieldset>
|
@@ -1,15 +1,15 @@
|
|
1
|
-
<%
|
2
|
-
property_name = property[:name]
|
3
|
-
length = property[:length]
|
4
|
-
label = property[:pretty_name]
|
5
|
-
required = !property[:nullable?]
|
6
|
-
%>
|
7
|
-
<div>
|
8
|
-
<%= text_field(property_name, :size => [50, length].min, :maxlength => length, :label => label) %>
|
9
|
-
<% if property_name.to_s =~ /(image|logo|photo|photograph|picture|thumb|thumbnail)_ur(i|l)/i %>
|
10
|
-
<img src="<%= @object.send(property_name) %>" width="10" height"10" />
|
11
|
-
<% end %>
|
12
|
-
<p class="help">
|
13
|
-
<%= required ? "Required." : "Optional." %> <%= length %> <%= length == 1 ? "character." : "characters or fewer." %>
|
14
|
-
</p>
|
15
|
-
</div>
|
1
|
+
<%
|
2
|
+
property_name = property[:name]
|
3
|
+
length = property[:length].to_i
|
4
|
+
label = property[:pretty_name]
|
5
|
+
required = !property[:nullable?]
|
6
|
+
%>
|
7
|
+
<div>
|
8
|
+
<%= text_field(property_name, :size => [50, length].min, :maxlength => length, :label => label) %>
|
9
|
+
<% if property_name.to_s =~ /(image|logo|photo|photograph|picture|thumb|thumbnail)_ur(i|l)/i %>
|
10
|
+
<img src="<%= @object.send(property_name) %>" width="10" height"10" />
|
11
|
+
<% end %>
|
12
|
+
<p class="help">
|
13
|
+
<%= required ? "Required." : "Optional." %> <%= length %> <%= length == 1 ? "character." : "characters or fewer." %>
|
14
|
+
</p>
|
15
|
+
</div>
|
@@ -1,11 +1,11 @@
|
|
1
|
-
<%
|
2
|
-
name = property[:name]
|
3
|
-
label = property[:pretty_name]
|
4
|
-
required = !property[:nullable?]
|
5
|
-
%>
|
6
|
-
<div>
|
7
|
-
<%= text_area(name, :cols => 80, :label => label) %>
|
8
|
-
<p class="help">
|
9
|
-
<%= required ? "Required." : "Optional." %>
|
10
|
-
</p>
|
11
|
-
</div>
|
1
|
+
<%
|
2
|
+
name = property[:name]
|
3
|
+
label = property[:pretty_name]
|
4
|
+
required = !property[:nullable?]
|
5
|
+
%>
|
6
|
+
<div>
|
7
|
+
<%= text_area(name, :cols => 80, :label => label) %>
|
8
|
+
<p class="help">
|
9
|
+
<%= required ? "Required." : "Optional." %>
|
10
|
+
</p>
|
11
|
+
</div>
|
@@ -1,12 +1,12 @@
|
|
1
|
-
<%
|
2
|
-
property_name = property[:name]
|
3
|
-
value = @object.send(property_name)
|
4
|
-
label = property[:pretty_name]
|
5
|
-
required = !property[:nullable?]
|
6
|
-
%>
|
7
|
-
<div>
|
8
|
-
<%= text_field(property_name, :class => "vTimeField", :value => value.respond_to?(:strftime) ? value.strftime("%H:%M:%S") : nil, :label => label) %>
|
9
|
-
<p class="help">
|
10
|
-
<%= required ? "Required." : "Optional." %>
|
11
|
-
</p>
|
12
|
-
</div>
|
1
|
+
<%
|
2
|
+
property_name = property[:name]
|
3
|
+
value = @object.send(property_name)
|
4
|
+
label = property[:pretty_name]
|
5
|
+
required = !property[:nullable?]
|
6
|
+
%>
|
7
|
+
<div>
|
8
|
+
<%= text_field(property_name, :class => "vTimeField", :value => value.respond_to?(:strftime) ? value.strftime("%H:%M:%S") : nil, :label => label) %>
|
9
|
+
<p class="help">
|
10
|
+
<%= required ? "Required." : "Optional." %>
|
11
|
+
</p>
|
12
|
+
</div>
|
@@ -1,12 +1,12 @@
|
|
1
|
-
<%
|
2
|
-
property_name = property[:name]
|
3
|
-
value = @object.send(property_name)
|
4
|
-
label = property[:pretty_name]
|
5
|
-
required = !property[:nullable?]
|
6
|
-
%>
|
7
|
-
<div>
|
8
|
-
<%= text_field(property_name, :class => "vDateField", :value => value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S") : nil, :label => label) %>
|
9
|
-
<p class="help">
|
10
|
-
<%= required ? "Required." : "Optional." %>
|
11
|
-
</p>
|
12
|
-
</div>
|
1
|
+
<%
|
2
|
+
property_name = property[:name]
|
3
|
+
value = @object.send(property_name)
|
4
|
+
label = property[:pretty_name]
|
5
|
+
required = !property[:nullable?]
|
6
|
+
%>
|
7
|
+
<div>
|
8
|
+
<%= text_field(property_name, :class => "vDateField", :value => value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S") : nil, :label => label) %>
|
9
|
+
<p class="help">
|
10
|
+
<%= required ? "Required." : "Optional." %>
|
11
|
+
</p>
|
12
|
+
</div>
|
@@ -1,28 +1,28 @@
|
|
1
|
-
<p>Are you sure you want to delete the <%= @abstract_model.pretty_name.downcase %> “<%= object_label(@object) %>”? All of the following related items will be deleted:</p>
|
2
|
-
<ul>
|
3
|
-
<li>
|
4
|
-
<%= @abstract_model.pretty_name %>: <%= link_to(object_label(@object), url(:merb_admin_edit, :model_name => @abstract_model.to_param, :id => @object.id)) %>
|
5
|
-
<ul>
|
6
|
-
<% @abstract_model.has_many_associations.each do |association| %>
|
7
|
-
<% @object.send(association[:name]).reject{|child| child.nil?}.each do |child| %>
|
8
|
-
<li>
|
9
|
-
One or more <%= @abstract_model.pretty_name.pluralize.downcase %> in <%= association[:pretty_name].downcase %>: <%= link_to(object_label(child), url(:merb_admin_edit, :model_name => association[:name].to_s.singularize.to_sym, :id => child.id)) %>
|
10
|
-
</li>
|
11
|
-
<% end %>
|
12
|
-
<% end %>
|
13
|
-
<% @abstract_model.has_one_associations.each do |association| %>
|
14
|
-
<% child = @object.send(association[:name]) %>
|
15
|
-
<% next if child.nil? %>
|
16
|
-
<li>
|
17
|
-
A <%= @abstract_model.pretty_name.downcase %> in <%= association[:pretty_name].downcase %>: <%= link_to(object_label(child), url(:merb_admin_edit, :model_name => association[:name], :id => child.id)) %>
|
18
|
-
</li>
|
19
|
-
<% end %>
|
20
|
-
</ul>
|
21
|
-
</li>
|
22
|
-
</ul>
|
23
|
-
<%= form_for(@object, :action => url(:merb_admin_destroy, :model_name => @abstract_model.to_param, :id => @object.id), :method => :delete) do %>
|
24
|
-
<div>
|
25
|
-
<%= submit "Yes, I'm sure" %>
|
26
|
-
</div>
|
27
|
-
<% end =%>
|
28
|
-
|
1
|
+
<p>Are you sure you want to delete the <%= @abstract_model.pretty_name.downcase %> “<%= object_label(@object) %>”? All of the following related items will be deleted:</p>
|
2
|
+
<ul>
|
3
|
+
<li>
|
4
|
+
<%= @abstract_model.pretty_name %>: <%= link_to(object_label(@object), url(:merb_admin_edit, :model_name => @abstract_model.to_param, :id => @object.id)) %>
|
5
|
+
<ul>
|
6
|
+
<% @abstract_model.has_many_associations.each do |association| %>
|
7
|
+
<% @object.send(association[:name]).reject{|child| child.nil?}.each do |child| %>
|
8
|
+
<li>
|
9
|
+
One or more <%= @abstract_model.pretty_name.pluralize.downcase %> in <%= association[:pretty_name].downcase %>: <%= link_to(object_label(child), url(:merb_admin_edit, :model_name => association[:name].to_s.singularize.to_sym, :id => child.id)) %>
|
10
|
+
</li>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
<% @abstract_model.has_one_associations.each do |association| %>
|
14
|
+
<% child = @object.send(association[:name]) %>
|
15
|
+
<% next if child.nil? %>
|
16
|
+
<li>
|
17
|
+
A <%= @abstract_model.pretty_name.downcase %> in <%= association[:pretty_name].downcase %>: <%= link_to(object_label(child), url(:merb_admin_edit, :model_name => association[:name], :id => child.id)) %>
|
18
|
+
</li>
|
19
|
+
<% end %>
|
20
|
+
</ul>
|
21
|
+
</li>
|
22
|
+
</ul>
|
23
|
+
<%= form_for(@object, :action => url(:merb_admin_destroy, :model_name => @abstract_model.to_param, :id => @object.id), :method => :delete) do %>
|
24
|
+
<div>
|
25
|
+
<%= submit "Yes, I'm sure" %>
|
26
|
+
</div>
|
27
|
+
<% end =%>
|
28
|
+
|
@@ -1,19 +1,19 @@
|
|
1
|
-
<div id="content-main">
|
2
|
-
<%= form_for(@object, :action => url(:merb_admin_update, :model_name => @abstract_model.to_param, :id => @object.id)) do %>
|
3
|
-
<div>
|
4
|
-
<%= partial('properties', :properties => @properties) -%>
|
5
|
-
<%= partial('belongs_to', :with => @abstract_model.belongs_to_associations, :as => :association) -%>
|
6
|
-
<%= partial('has_one', :with => @abstract_model.has_one_associations, :as => :association) -%>
|
7
|
-
<%= partial('has_many', :with => @abstract_model.has_many_associations, :as => :association) -%>
|
8
|
-
<div class="submit-row" >
|
9
|
-
<%= submit "Save", :class => "default", :name => "_save" %>
|
10
|
-
<p class="deletelink-box">
|
11
|
-
<%= link_to("Delete", url(:merb_admin_delete, :model_name => @abstract_model.to_param, :id => @object.id), :class => "deletelink") %>
|
12
|
-
</p>
|
13
|
-
<%= submit "Save and add another", :name => "_add_another" %>
|
14
|
-
<%= submit "Save and continue editing", :name => "_continue" %>
|
15
|
-
</div>
|
16
|
-
</div>
|
17
|
-
<% end =%>
|
18
|
-
|
19
|
-
</div>
|
1
|
+
<div id="content-main">
|
2
|
+
<%= form_for(@object, :action => url(:merb_admin_update, :model_name => @abstract_model.to_param, :id => @object.id)) do %>
|
3
|
+
<div>
|
4
|
+
<%= partial('properties', :properties => @properties) -%>
|
5
|
+
<%= partial('belongs_to', :with => @abstract_model.belongs_to_associations, :as => :association) -%>
|
6
|
+
<%= partial('has_one', :with => @abstract_model.has_one_associations, :as => :association) -%>
|
7
|
+
<%= partial('has_many', :with => @abstract_model.has_many_associations, :as => :association) -%>
|
8
|
+
<div class="submit-row" >
|
9
|
+
<%= submit "Save", :class => "default", :name => "_save" %>
|
10
|
+
<p class="deletelink-box">
|
11
|
+
<%= link_to("Delete", url(:merb_admin_delete, :model_name => @abstract_model.to_param, :id => @object.id), :class => "deletelink") %>
|
12
|
+
</p>
|
13
|
+
<%= submit "Save and add another", :name => "_add_another" %>
|
14
|
+
<%= submit "Save and continue editing", :name => "_continue" %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<% end =%>
|
18
|
+
|
19
|
+
</div>
|
@@ -1,22 +1,22 @@
|
|
1
|
-
<div id="content-main">
|
2
|
-
<div class="module">
|
3
|
-
<table summary="Models available in the application.">
|
4
|
-
<caption>
|
5
|
-
<%= link_to("Models", url(:merb_admin_dashboard), :class => "section") %>
|
6
|
-
</caption>
|
7
|
-
<% @abstract_models.each do |abstract_model| %>
|
8
|
-
<tr>
|
9
|
-
<th scope="row">
|
10
|
-
<%= link_to(abstract_model.pretty_name, url(:merb_admin_list, :model_name => abstract_model.to_param)) %>
|
11
|
-
</th>
|
12
|
-
<td>
|
13
|
-
<%= link_to("Add", url(:merb_admin_new, :model_name => abstract_model.to_param), :class => "addlink") %>
|
14
|
-
</td>
|
15
|
-
<td>
|
16
|
-
<%= link_to("Edit", url(:merb_admin_list, :model_name => abstract_model.to_param), :class => "changelink") %>
|
17
|
-
</td>
|
18
|
-
</tr>
|
19
|
-
<% end %>
|
20
|
-
</table>
|
21
|
-
</div>
|
22
|
-
</div>
|
1
|
+
<div id="content-main">
|
2
|
+
<div class="module">
|
3
|
+
<table summary="Models available in the application.">
|
4
|
+
<caption>
|
5
|
+
<%= link_to("Models", url(:merb_admin_dashboard), :class => "section") %>
|
6
|
+
</caption>
|
7
|
+
<% @abstract_models.each do |abstract_model| %>
|
8
|
+
<tr>
|
9
|
+
<th scope="row">
|
10
|
+
<%= link_to(abstract_model.pretty_name, url(:merb_admin_list, :model_name => abstract_model.to_param)) %>
|
11
|
+
</th>
|
12
|
+
<td>
|
13
|
+
<%= link_to("Add", url(:merb_admin_new, :model_name => abstract_model.to_param), :class => "addlink") %>
|
14
|
+
</td>
|
15
|
+
<td>
|
16
|
+
<%= link_to("Edit", url(:merb_admin_list, :model_name => abstract_model.to_param), :class => "changelink") %>
|
17
|
+
</td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
21
|
+
</div>
|
22
|
+
</div>
|
@@ -1,93 +1,93 @@
|
|
1
|
-
<%
|
2
|
-
params = request.params.except(:action, :controller, :model_name)
|
3
|
-
query = params[:query]
|
4
|
-
filter = params[:filter]
|
5
|
-
sort = params[:sort]
|
6
|
-
sort_reverse = params[:sort_reverse]
|
7
|
-
filters_exist = !@properties.select{|property| property[:type] == :boolean}.empty?
|
8
|
-
%>
|
9
|
-
<div id="content-main">
|
10
|
-
<ul class="object-tools">
|
11
|
-
<li>
|
12
|
-
<%= link_to("Add #{@abstract_model.pretty_name.downcase}", url(:merb_admin_new, :model_name => @abstract_model.to_param), :class => "addlink") %>
|
13
|
-
</li>
|
14
|
-
</ul>
|
15
|
-
<div class="<%= filters_exist ? "module filtered" : "module" %>" id="changelist">
|
16
|
-
<div id="toolbar">
|
17
|
-
<form id="changelist-search" action="" method="get">
|
18
|
-
<div>
|
19
|
-
<label for="searchbar"><img src="<%= image_path("icon_searchbox.png") %>" alt="Search" /></label>
|
20
|
-
<input type="text" size="40" name="query" value="<%= query %>" id="searchbar" />
|
21
|
-
<input type="submit" value="Search" />
|
22
|
-
<% if query || filter %>
|
23
|
-
<span class="small quiet"><%= @record_count %> <%= @record_count == 1 ? "result" : "results" %> (<%= link_to("#{@abstract_model.count} total", "?") %>)</span>
|
24
|
-
<% end %>
|
25
|
-
<% if filter %>
|
26
|
-
<% filter.each do |name, value| %>
|
27
|
-
<input type="hidden" name="filter[<%= name %>]" value="<%= value %>"/>
|
28
|
-
<% end %>
|
29
|
-
<% end %>
|
30
|
-
</div>
|
31
|
-
</form>
|
32
|
-
</div>
|
33
|
-
<script type="text/javascript">document.getElementById("searchbar").focus();</script>
|
34
|
-
<% if filters_exist %>
|
35
|
-
<div id="changelist-filter">
|
36
|
-
<h2>Filter</h2>
|
37
|
-
<% @properties.each do |property| %>
|
38
|
-
<% property_type = property[:type] %>
|
39
|
-
<% property_name = property[:name] %>
|
40
|
-
<% property_pretty_name = property[:pretty_name] %>
|
41
|
-
<% if property_type == :boolean %>
|
42
|
-
<h3>By <%= property_pretty_name %></h3>
|
43
|
-
<ul>
|
44
|
-
<li class="<%= filter.nil? || filter[property_name].blank? ? "selected" : nil %>">
|
45
|
-
<%= link_to("All", "?" + Merb::Parse.params_to_query_string(params.merge(:filter => (filter || {}).reject{|key, value| key.to_sym == property_name}))) %>
|
46
|
-
</li>
|
47
|
-
<li class="<%= filter && filter[property_name] == "true" ? "selected" : nil %>">
|
48
|
-
<%= link_to("Yes", "?" + Merb::Parse.params_to_query_string(params.merge(:filter => (filter || {}).merge({property_name => "true"})))) %>
|
49
|
-
</li>
|
50
|
-
<li class="<%= filter && filter[property_name] == "false" ? "selected" : nil %>">
|
51
|
-
<%= link_to("No", "?" + Merb::Parse.params_to_query_string(params.merge(:filter => (filter || {}).merge({property_name => "false"})))) %>
|
52
|
-
</li>
|
53
|
-
</ul>
|
54
|
-
<% end %>
|
55
|
-
<% end %>
|
56
|
-
</div>
|
57
|
-
<% end %>
|
58
|
-
<table cellspacing="0">
|
59
|
-
<thead>
|
60
|
-
<tr>
|
61
|
-
<% @properties.each do |property| %>
|
62
|
-
<% property_name = property[:name] %>
|
63
|
-
<% property_pretty_name = property[:pretty_name] %>
|
64
|
-
<th class="<%= sort == property_name.to_s ? sort_reverse ? "sorted descending" : "sorted ascending" : nil %>">
|
65
|
-
<%= link_to(property_pretty_name, "?" + Merb::Parse.params_to_query_string(params.merge(:sort => property_name).reject{|key, value| key.to_sym == :sort_reverse}.merge(sort == property_name.to_s && sort_reverse != "true" ? {:sort_reverse => "true"} : {}))) %>
|
66
|
-
</th>
|
67
|
-
<% end %>
|
68
|
-
</tr>
|
69
|
-
</thead>
|
70
|
-
<tbody>
|
71
|
-
<% @objects.each_with_index do |object, index| %>
|
72
|
-
<tr class="row<%= index % 2 == 0 ? "1" : "2" %>">
|
73
|
-
<% @properties.each do |property| %>
|
74
|
-
<td>
|
75
|
-
<%= link_to(object_property(object, property), url(:merb_admin_edit, :model_name => @abstract_model.to_param, :id => object.id)) %>
|
76
|
-
</td>
|
77
|
-
<% end %>
|
78
|
-
</tr>
|
79
|
-
<% end %>
|
80
|
-
</tbody>
|
81
|
-
</table>
|
82
|
-
<p class="paginator">
|
83
|
-
<% if @page_count.to_i > 1 %>
|
84
|
-
<%= paginate(@current_page, @page_count, :url => "?" + Merb::Parse.params_to_query_string(params)) %>
|
85
|
-
<% end %>
|
86
|
-
<%= @record_count %> <%= @record_count == 1 ? @abstract_model.pretty_name.downcase : @abstract_model.pretty_name.downcase.pluralize %>
|
87
|
-
<% if @page_count.to_i == 2 %>
|
88
|
-
<%= link_to("Show all", "?" + Merb::Parse.params_to_query_string(params.merge(:all => true)), :class => "showall") %>
|
89
|
-
<% end %>
|
90
|
-
</p>
|
91
|
-
</div>
|
92
|
-
</div>
|
93
|
-
<br class="clear" />
|
1
|
+
<%
|
2
|
+
params = request.params.except(:action, :controller, :model_name)
|
3
|
+
query = params[:query]
|
4
|
+
filter = params[:filter]
|
5
|
+
sort = params[:sort]
|
6
|
+
sort_reverse = params[:sort_reverse]
|
7
|
+
filters_exist = !@properties.select{|property| property[:type] == :boolean}.empty?
|
8
|
+
%>
|
9
|
+
<div id="content-main">
|
10
|
+
<ul class="object-tools">
|
11
|
+
<li>
|
12
|
+
<%= link_to("Add #{@abstract_model.pretty_name.downcase}", url(:merb_admin_new, :model_name => @abstract_model.to_param), :class => "addlink") %>
|
13
|
+
</li>
|
14
|
+
</ul>
|
15
|
+
<div class="<%= filters_exist ? "module filtered" : "module" %>" id="changelist">
|
16
|
+
<div id="toolbar">
|
17
|
+
<form id="changelist-search" action="" method="get">
|
18
|
+
<div>
|
19
|
+
<label for="searchbar"><img src="<%= image_path("icon_searchbox.png") %>" alt="Search" /></label>
|
20
|
+
<input type="text" size="40" name="query" value="<%= query %>" id="searchbar" />
|
21
|
+
<input type="submit" value="Search" />
|
22
|
+
<% if query || filter %>
|
23
|
+
<span class="small quiet"><%= @record_count %> <%= @record_count == 1 ? "result" : "results" %> (<%= link_to("#{@abstract_model.count} total", "?") %>)</span>
|
24
|
+
<% end %>
|
25
|
+
<% if filter %>
|
26
|
+
<% filter.each do |name, value| %>
|
27
|
+
<input type="hidden" name="filter[<%= name %>]" value="<%= value %>"/>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
</div>
|
31
|
+
</form>
|
32
|
+
</div>
|
33
|
+
<script type="text/javascript">document.getElementById("searchbar").focus();</script>
|
34
|
+
<% if filters_exist %>
|
35
|
+
<div id="changelist-filter">
|
36
|
+
<h2>Filter</h2>
|
37
|
+
<% @properties.each do |property| %>
|
38
|
+
<% property_type = property[:type] %>
|
39
|
+
<% property_name = property[:name] %>
|
40
|
+
<% property_pretty_name = property[:pretty_name] %>
|
41
|
+
<% if property_type == :boolean %>
|
42
|
+
<h3>By <%= property_pretty_name %></h3>
|
43
|
+
<ul>
|
44
|
+
<li class="<%= filter.nil? || filter[property_name].blank? ? "selected" : nil %>">
|
45
|
+
<%= link_to("All", "?" + Merb::Parse.params_to_query_string(params.merge(:filter => (filter || {}).reject{|key, value| key.to_sym == property_name}))) %>
|
46
|
+
</li>
|
47
|
+
<li class="<%= filter && filter[property_name] == "true" ? "selected" : nil %>">
|
48
|
+
<%= link_to("Yes", "?" + Merb::Parse.params_to_query_string(params.merge(:filter => (filter || {}).merge({property_name => "true"})))) %>
|
49
|
+
</li>
|
50
|
+
<li class="<%= filter && filter[property_name] == "false" ? "selected" : nil %>">
|
51
|
+
<%= link_to("No", "?" + Merb::Parse.params_to_query_string(params.merge(:filter => (filter || {}).merge({property_name => "false"})))) %>
|
52
|
+
</li>
|
53
|
+
</ul>
|
54
|
+
<% end %>
|
55
|
+
<% end %>
|
56
|
+
</div>
|
57
|
+
<% end %>
|
58
|
+
<table cellspacing="0">
|
59
|
+
<thead>
|
60
|
+
<tr>
|
61
|
+
<% @properties.each do |property| %>
|
62
|
+
<% property_name = property[:name] %>
|
63
|
+
<% property_pretty_name = property[:pretty_name] %>
|
64
|
+
<th class="<%= sort == property_name.to_s ? sort_reverse ? "sorted descending" : "sorted ascending" : nil %>">
|
65
|
+
<%= link_to(property_pretty_name, "?" + Merb::Parse.params_to_query_string(params.merge(:sort => property_name).reject{|key, value| key.to_sym == :sort_reverse}.merge(sort == property_name.to_s && sort_reverse != "true" ? {:sort_reverse => "true"} : {}))) %>
|
66
|
+
</th>
|
67
|
+
<% end %>
|
68
|
+
</tr>
|
69
|
+
</thead>
|
70
|
+
<tbody>
|
71
|
+
<% @objects.each_with_index do |object, index| %>
|
72
|
+
<tr class="row<%= index % 2 == 0 ? "1" : "2" %>">
|
73
|
+
<% @properties.each do |property| %>
|
74
|
+
<td>
|
75
|
+
<%= link_to(object_property(object, property), url(:merb_admin_edit, :model_name => @abstract_model.to_param, :id => object.id)) %>
|
76
|
+
</td>
|
77
|
+
<% end %>
|
78
|
+
</tr>
|
79
|
+
<% end %>
|
80
|
+
</tbody>
|
81
|
+
</table>
|
82
|
+
<p class="paginator">
|
83
|
+
<% if @page_count.to_i > 1 %>
|
84
|
+
<%= paginate(@current_page, @page_count, :url => "?" + Merb::Parse.params_to_query_string(params)) %>
|
85
|
+
<% end %>
|
86
|
+
<%= @record_count %> <%= @record_count == 1 ? @abstract_model.pretty_name.downcase : @abstract_model.pretty_name.downcase.pluralize %>
|
87
|
+
<% if @page_count.to_i == 2 %>
|
88
|
+
<%= link_to("Show all", "?" + Merb::Parse.params_to_query_string(params.merge(:all => true)), :class => "showall") %>
|
89
|
+
<% end %>
|
90
|
+
</p>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
<br class="clear" />
|