easy_admin_ui 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{easy_admin_ui}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Martin Moen Wulffeld"]
12
- s.date = %q{2010-07-27}
12
+ s.date = %q{2010-09-19}
13
13
  s.description = %q{Very simple DRY admin UI.}
14
14
  s.email = %q{martin@wulffeld.org}
15
15
  s.extra_rdoc_files = [
@@ -40,14 +40,14 @@ Gem::Specification.new do |s|
40
40
  s.homepage = %q{http://github.com/wulffeld/easy_admin_ui}
41
41
  s.rdoc_options = ["--charset=UTF-8"]
42
42
  s.require_paths = ["lib"]
43
- s.rubygems_version = %q{1.3.6}
43
+ s.rubygems_version = %q{1.3.7}
44
44
  s.summary = %q{Easy Admin UI.}
45
45
 
46
46
  if s.respond_to? :specification_version then
47
47
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
48
48
  s.specification_version = 3
49
49
 
50
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
51
  else
52
52
  end
53
53
  else
@@ -4,8 +4,19 @@ module EasyAdminUi
4
4
  will_paginate(collection, :previous_label => t('will_paginate.previous'), :next_label => t('will_paginate.next'))
5
5
  end
6
6
 
7
- def table_head(titles, actions, options = {:class => "easy"})
8
- concat("<table class='#{options[:class]}' id='#{options[:id]}'>" +
7
+ def table(items, titles, actions, options = {}, &block)
8
+ html = ''.html_safe
9
+ html << table_head(titles, actions, options)
10
+ html << render(items)
11
+ html << my_table_end
12
+ html
13
+ end
14
+
15
+ def table_head(titles, actions, options = {})
16
+ options[:class] ||= 'easy'
17
+ html = ''.html_safe
18
+ html << "<table class='#{options[:class]}' id='#{options[:id]}'>".html_safe
19
+ html <<
9
20
  content_tag(:thead,
10
21
  content_tag(:tr, (
11
22
  titles.map do |title, th_class|
@@ -16,7 +27,7 @@ module EasyAdminUi
16
27
  content_tag(:div,
17
28
  link_to('', '#', :class => 'sort_up') +
18
29
  link_to('', '#', :class => 'sort_down'),
19
- :class => 'sort')
30
+ {:class => 'sort'})
20
31
  else
21
32
  nil
22
33
  end,
@@ -24,13 +35,11 @@ module EasyAdminUi
24
35
  ].compact.join(''),
25
36
  :class => th_class)
26
37
  end
27
- ).join('') + (actions ? content_tag(:th, '', :class => 'actions') : '')
38
+ ).join('').html_safe + (actions ? content_tag(:th, '', :class => 'actions') : '')
28
39
  )
29
40
  )
30
- )
31
- options[:body_id] ? concat("<tbody id=\"#{options[:body_id]}\">") : concat('<tbody>')
32
- yield
33
- concat('</tbody></table>')
41
+ html << options[:body_id] ? "<tbody id=\"#{options[:body_id]}\">" : '<tbody>'
42
+ html
34
43
  end
35
44
 
36
45
  def table_row(options = {})
@@ -48,9 +57,13 @@ module EasyAdminUi
48
57
  cell_opts ||= {}
49
58
  content_tag(:td, txt, cell_opts)
50
59
  end,
51
- options[:actions].blank? ? '' : content_tag(:td, options[:actions].join(' '), :class => "act")
52
- ].join(' '),
53
- :id => options[:id], :class => ["#{cyc = cycle("even", "odd")}", options[:class]].join(' '))
60
+ options[:actions].blank? ? '' : content_tag(:td, options[:actions].join(' ').html_safe, :class => "act")
61
+ ].join(' ').html_safe,
62
+ :id => options[:id], :class => ["#{cyc = cycle("even", "odd")}", options[:class]].join(' ')).html_safe
63
+ end
64
+
65
+ def my_table_end
66
+ '</tbody></table>'.html_safe
54
67
  end
55
68
 
56
69
  def right_align(content)
@@ -62,7 +75,7 @@ module EasyAdminUi
62
75
  end
63
76
 
64
77
  def admin_new_link
65
- content_tag(:span, ' - ' + link_to('New', :action => 'new'))
78
+ content_tag(:span, raw(' - ') + link_to('New', :action => 'new'))
66
79
  end
67
80
 
68
81
  def admin_edit_link(item)
@@ -79,7 +92,7 @@ module EasyAdminUi
79
92
  delete_path ||= eval("#{obj.class.to_s.underscore.singularize}_path(obj)")
80
93
  link_to_function(image_tag('/images/icons/delete.png'), "$('cnf_#{obj.id}').show();") + ' ' +
81
94
  raw('<span id="cnf_' + obj.id.to_s + '" class="conf_link" style="display: none;">Are you sure? ') +
82
- link_to_remote("Yes", :url => delete_path, :method => :delete) + ' ' +
95
+ link_to("Yes", delete_path, :method => :delete, :remote => true) + ' ' +
83
96
  link_to_function("No", "$('cnf_#{obj.id}').hide();") + raw('</span>')
84
97
  end
85
98
  end
@@ -10,11 +10,11 @@
10
10
  <%= render :partial => 'after_title' %>
11
11
  <% end -%>
12
12
 
13
- <% semantic_form_for(@item, :url => eval("admin_#{@item.class.to_s.underscore}_path(@item)"), :html => { :multipart => true }) do |f| %>
14
- <% f.inputs do %>
13
+ <%= semantic_form_for(@item, :url => eval("admin_#{@item.class.to_s.underscore}_path(@item)"), :html => { :multipart => true }) do |f| %>
14
+ <%= f.inputs do %>
15
15
  <%= render :partial => 'form', :locals => {:f => f} %>
16
16
  <% end -%>
17
- <% f.buttons do %>
17
+ <%= f.buttons do %>
18
18
  <%= f.commit_button 'Submit' %>
19
19
  <% end -%>
20
20
  <% end -%>
@@ -8,9 +8,7 @@
8
8
 
9
9
  <%= wpaginate @items if @items.respond_to?(:total_pages) %>
10
10
 
11
- <% table_head(@options[:columns], @options[:actions]) do %>
12
- <%= render @items %>
13
- <% end -%>
11
+ <%= table(@items, @options[:columns], @options[:actions]) %>
14
12
 
15
13
  <%= wpaginate @items if @items.respond_to?(:total_pages) %>
16
14
 
@@ -10,11 +10,11 @@
10
10
  <%= render :partial => 'after_title' %>
11
11
  <% end -%>
12
12
 
13
- <% semantic_form_for(@item, :url => eval("admin_#{@item.class.to_s.underscore.pluralize}_path"), :html => { :multipart => true }) do |f| %>
14
- <% f.inputs do %>
13
+ <%= semantic_form_for(@item, :url => eval("admin_#{@item.class.to_s.underscore.pluralize}_path"), :html => { :multipart => true }) do |f| %>
14
+ <%= f.inputs do %>
15
15
  <%= render :partial => 'form', :locals => {:f => f} %>
16
16
  <% end -%>
17
- <% f.buttons do %>
17
+ <%= f.buttons do %>
18
18
  <%= f.commit_button 'Submit' %>
19
19
  <% end -%>
20
20
  <% end -%>
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_admin_ui
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 1
8
+ - 2
8
9
  - 0
9
- version: 0.1.0
10
+ version: 0.2.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Martin Moen Wulffeld
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-07-27 00:00:00 +02:00
18
+ date: 2010-09-19 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -57,23 +58,27 @@ rdoc_options:
57
58
  require_paths:
58
59
  - lib
59
60
  required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
60
62
  requirements:
61
63
  - - ">="
62
64
  - !ruby/object:Gem::Version
65
+ hash: 3
63
66
  segments:
64
67
  - 0
65
68
  version: "0"
66
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
67
71
  requirements:
68
72
  - - ">="
69
73
  - !ruby/object:Gem::Version
74
+ hash: 3
70
75
  segments:
71
76
  - 0
72
77
  version: "0"
73
78
  requirements: []
74
79
 
75
80
  rubyforge_project:
76
- rubygems_version: 1.3.6
81
+ rubygems_version: 1.3.7
77
82
  signing_key:
78
83
  specification_version: 3
79
84
  summary: Easy Admin UI.