admin_assistant 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README +43 -0
- data/Rakefile +28 -0
- data/install.rb +1 -0
- data/lib/admin_assistant/builder.rb +104 -0
- data/lib/admin_assistant/column.rb +383 -0
- data/lib/admin_assistant/form_view.rb +124 -0
- data/lib/admin_assistant/helper.rb +7 -0
- data/lib/admin_assistant/index.rb +181 -0
- data/lib/admin_assistant/request.rb +183 -0
- data/lib/admin_assistant.rb +172 -0
- data/lib/images/sort-asc.png +0 -0
- data/lib/images/sort-desc.png +0 -0
- data/lib/stylesheets/admin_assistant.css +75 -0
- data/lib/views/form.html.erb +31 -0
- data/lib/views/index.html.erb +92 -0
- data/tasks/admin_assistant_tasks.rake +4 -0
- data/uninstall.rb +1 -0
- metadata +89 -0
@@ -0,0 +1,92 @@
|
|
1
|
+
<div id="admin_assistant" class="index <%=
|
2
|
+
@admin_assistant.controller_css_class(controller)
|
3
|
+
%>">
|
4
|
+
<script type="text/javascript">
|
5
|
+
function show_search_form() { $('search_form').show(); }
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<div id="header">
|
9
|
+
<div class="actions">
|
10
|
+
<%= link_to_function('Search', 'show_search_form()') %>
|
11
|
+
<%= link_to(
|
12
|
+
"New #{@admin_assistant.model_class_name}", @admin_assistant.url_params(:new)
|
13
|
+
) %>
|
14
|
+
<% @admin_assistant.index_settings.actions.each do |action, params| %>
|
15
|
+
<%= link_to_unless_current(action, params) %>
|
16
|
+
<% end %>
|
17
|
+
</div>
|
18
|
+
<h2><%= h(
|
19
|
+
@admin_assistant.model_class.name.pluralize.gsub(/([A-Z])/, ' \1')[1..-1]
|
20
|
+
) %></h2>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<% @search = @index.search %>
|
24
|
+
<% form_for(
|
25
|
+
:search,
|
26
|
+
:url => {:action => 'index'},
|
27
|
+
:html => {:id => 'search_form', :style => 'display:none', :method => 'get'}
|
28
|
+
) do |form| %>
|
29
|
+
<% @search.column_views(self).each do |column_view| %>
|
30
|
+
<%= column_view.search_html %>
|
31
|
+
<% end %>
|
32
|
+
<%= submit_tag('Search') %>
|
33
|
+
<%= link_to('Back to index', :action => 'index') if @index.search_terms %>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<% if @index.search_terms %>
|
37
|
+
<script type="text/javascript">
|
38
|
+
show_search_form();
|
39
|
+
</script>
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
<% if !@index.records.empty? %>
|
43
|
+
<table cellspacing="0" cellpadding="0">
|
44
|
+
<thead>
|
45
|
+
<tr>
|
46
|
+
<% @index.view(self).columns.each do |column| %>
|
47
|
+
<% th_class = column.index_header_css_class %>
|
48
|
+
<th<%= " class=\"#{th_class}\"" if th_class %>><%=
|
49
|
+
if column.sort_possible?
|
50
|
+
link_to(h(column.label), column.next_sort_params)
|
51
|
+
else
|
52
|
+
h(column.label)
|
53
|
+
end
|
54
|
+
%></th>
|
55
|
+
<% end %>
|
56
|
+
<% if @admin_assistant.update? || @admin_assistant.destroy? %>
|
57
|
+
<th></th>
|
58
|
+
<% end %>
|
59
|
+
</tr>
|
60
|
+
</thead>
|
61
|
+
<tbody>
|
62
|
+
<% @index.records.each do |record| %>
|
63
|
+
<tr class="<%= cycle('odd', 'even') %>" id="record_<%= record.id %>">
|
64
|
+
<% @index.view(self).columns.each do |column| %>
|
65
|
+
<% td_class = column.index_td_css_class %>
|
66
|
+
<td<%= " class=\"#{td_class}\"" if td_class %>><%=
|
67
|
+
column.index_html(record)
|
68
|
+
%></td>
|
69
|
+
<% end %>
|
70
|
+
<% if @admin_assistant.update? || @admin_assistant.destroy? %>
|
71
|
+
<td>
|
72
|
+
<% if @admin_assistant.update? %>
|
73
|
+
<%= link_to 'Edit', :action => 'edit', :id => record.id %>
|
74
|
+
<% end %>
|
75
|
+
<% if @admin_assistant.destroy? %>
|
76
|
+
<%= link_to_remote(
|
77
|
+
'Delete',
|
78
|
+
:url => {:action => 'destroy', :id => record.id},
|
79
|
+
:confirm => 'Are you sure?',
|
80
|
+
:success => "Effect.Fade('record_#{record.id}')"
|
81
|
+
) %>
|
82
|
+
<% end %>
|
83
|
+
</td>
|
84
|
+
<% end %>
|
85
|
+
</tr>
|
86
|
+
<% end %>
|
87
|
+
</tbody>
|
88
|
+
</table>
|
89
|
+
<%= will_paginate @index.records %>
|
90
|
+
<% end %>
|
91
|
+
<%= @index.records.empty? ? 'No' : @index.records.total_entries %> <%= @admin_assistant.model_class_name %><%= 's' unless @index.records.total_entries == 1 %> found
|
92
|
+
</div>
|
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: admin_assistant
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Francis Hwang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-02-19 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ar_query
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: mislav-will_paginate
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description: ""
|
36
|
+
email: sera@fhwang.net
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files: []
|
42
|
+
|
43
|
+
files:
|
44
|
+
- MIT-LICENSE
|
45
|
+
- README
|
46
|
+
- install.rb
|
47
|
+
- uninstall.rb
|
48
|
+
- Rakefile
|
49
|
+
- lib/admin_assistant.rb
|
50
|
+
- lib/admin_assistant/builder.rb
|
51
|
+
- lib/admin_assistant/column.rb
|
52
|
+
- lib/admin_assistant/form_view.rb
|
53
|
+
- lib/admin_assistant/helper.rb
|
54
|
+
- lib/admin_assistant/index.rb
|
55
|
+
- lib/admin_assistant/request.rb
|
56
|
+
- lib/images/sort-asc.png
|
57
|
+
- lib/images/sort-desc.png
|
58
|
+
- lib/stylesheets/admin_assistant.css
|
59
|
+
- lib/views/form.html.erb
|
60
|
+
- lib/views/index.html.erb
|
61
|
+
- tasks/admin_assistant_tasks.rake
|
62
|
+
has_rdoc: false
|
63
|
+
homepage: http://github.com/fhwang/admin_assistant/tree/master
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: "0"
|
74
|
+
version:
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
version:
|
81
|
+
requirements: []
|
82
|
+
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 1.3.1
|
85
|
+
signing_key:
|
86
|
+
specification_version: 2
|
87
|
+
summary: ""
|
88
|
+
test_files: []
|
89
|
+
|