beef-admin_area 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +7 -0
- data/Rakefile +59 -0
- data/VERSION +1 -0
- data/admin_area.gemspec +168 -0
- data/app/controllers/admin/base_controller.rb +8 -0
- data/app/controllers/admin/settings_controller.rb +43 -0
- data/app/controllers/admin/users_controller.rb +74 -0
- data/app/helpers/admin/base_helper.rb +59 -0
- data/app/helpers/admin/settings_helper.rb +8 -0
- data/app/helpers/admin/users_helper.rb +2 -0
- data/app/models/settings.rb +92 -0
- data/app/views/admin/base/index.html.erb +2 -0
- data/app/views/admin/settings/_form.html.erb +31 -0
- data/app/views/admin/settings/update.js.rjs +1 -0
- data/app/views/admin/users/index.html.erb +39 -0
- data/app/views/admin/users/show.html.erb +37 -0
- data/app/views/layouts/admin.html.erb +68 -0
- data/config/routes.rb +8 -0
- data/generators/admin_area_files/USAGE +8 -0
- data/generators/admin_area_files/admin_area_files_generator.rb +114 -0
- data/generators/admin_area_files/lib/insert_commands.rb +47 -0
- data/generators/admin_area_files/templates/app/models/content_sweeper.rb +43 -0
- data/generators/admin_area_files/templates/app/views/admin/settings/show.html.erb +52 -0
- data/generators/admin_area_files/templates/config/initializers/admin_area.rb +2 -0
- data/generators/admin_area_files/templates/config/initializers/settings.rb +8 -0
- data/generators/admin_area_files/templates/lib/tasks/admin_area.rake +10 -0
- data/generators/admin_area_files/templates/migration.rb +21 -0
- data/generators/admin_area_files/templates/public/images/admin/accept_button.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/add.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/application_cascade.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/arrow_left.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/arrow_right.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/button_bg.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/cancel_button.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/cursor_arrow.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/delete_button.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/down_icon.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/edit_button.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/file-uploads.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/folder.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/folder_image.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/head_bg.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/image_add.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/images-pointer.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/info_bg.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/nav_bg.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/over_button_bg.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/page_bg.gif +0 -0
- data/generators/admin_area_files/templates/public/images/admin/page_white.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/page_white_get.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/page_white_link.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/page_white_stack.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/picture.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/picture_medium.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/picture_square.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/picture_thumb.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/pictures.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/unapproved.png +0 -0
- data/generators/admin_area_files/templates/public/images/admin/up_icon.gif +0 -0
- data/generators/admin_area_files/templates/public/images/lightwindow/Thumbs.db +0 -0
- data/generators/admin_area_files/templates/public/images/lightwindow/ajax-loading.gif +0 -0
- data/generators/admin_area_files/templates/public/images/lightwindow/arrow-down.gif +0 -0
- data/generators/admin_area_files/templates/public/images/lightwindow/arrow-up.gif +0 -0
- data/generators/admin_area_files/templates/public/images/lightwindow/black-70.png +0 -0
- data/generators/admin_area_files/templates/public/images/lightwindow/black.png +0 -0
- data/generators/admin_area_files/templates/public/images/lightwindow/nextlabel.gif +0 -0
- data/generators/admin_area_files/templates/public/images/lightwindow/pattern_148-70.png +0 -0
- data/generators/admin_area_files/templates/public/images/lightwindow/pattern_148.gif +0 -0
- data/generators/admin_area_files/templates/public/images/lightwindow/prevlabel.gif +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/background.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/blockquote.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/bold.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/center.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/h1.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/h2.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/h3.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/h4.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/h5.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/h6.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/indent.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/italic.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/justify.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/left.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/link.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/list_bullets.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/list_numbers.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/omega.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/outdent.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/paragraph.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/preview.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/right.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/strikethrough.png +0 -0
- data/generators/admin_area_files/templates/public/images/textile-editor/underline.png +0 -0
- data/generators/admin_area_files/templates/public/javascripts/admin/application.js +185 -0
- data/generators/admin_area_files/templates/public/javascripts/lightwindow.js +1921 -0
- data/generators/admin_area_files/templates/public/javascripts/textile-editor-config.js +107 -0
- data/generators/admin_area_files/templates/public/javascripts/textile-editor.js +788 -0
- data/generators/admin_area_files/templates/public/stylesheets/admin/handheld.css +6 -0
- data/generators/admin_area_files/templates/public/stylesheets/admin/ie.css +21 -0
- data/generators/admin_area_files/templates/public/stylesheets/admin/print.css +27 -0
- data/generators/admin_area_files/templates/public/stylesheets/admin/screen.css +996 -0
- data/generators/admin_area_files/templates/public/stylesheets/admin/theme-1.0.css +131 -0
- data/generators/admin_area_files/templates/public/stylesheets/lightwindow.css +376 -0
- data/generators/admin_area_files/templates/public/stylesheets/textile-editor.css +60 -0
- data/generators/admin_scaffold/USAGE +8 -0
- data/generators/admin_scaffold/admin_scaffold_generator.rb +53 -0
- data/generators/admin_scaffold/lib/insert_commands.rb +61 -0
- data/generators/admin_scaffold/templates/admin_controller.rb +83 -0
- data/generators/admin_scaffold/templates/admin_index.html.erb +38 -0
- data/generators/admin_scaffold/templates/admin_show.html.erb +16 -0
- data/generators/admin_scaffold/templates/helper.rb +2 -0
- data/generators/admin_scaffold/templates/helper_test.rb +4 -0
- data/generators/admin_scaffold/templates/layout.html.erb +17 -0
- data/generators/admin_scaffold/templates/style.css +54 -0
- data/generators/admin_scaffold/templates/view_controller.rb +14 -0
- data/generators/admin_scaffold/templates/view_index.html.erb +17 -0
- data/lib/admin_area.rb +82 -0
- data/rails/init.rb +4 -0
- data/test/admin_area_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +206 -0
@@ -0,0 +1,92 @@
|
|
1
|
+
class Settings < ActiveRecord::Base
|
2
|
+
class SettingNotFound < RuntimeError; end
|
3
|
+
|
4
|
+
cattr_accessor :defaults
|
5
|
+
@@defaults = {}.with_indifferent_access
|
6
|
+
|
7
|
+
# Support old plugin
|
8
|
+
if defined?(SettingsDefaults::DEFAULTS)
|
9
|
+
@@defaults = SettingsDefaults::DEFAULTS.with_indifferent_access
|
10
|
+
end
|
11
|
+
|
12
|
+
#get or set a variable with the variable as the called method
|
13
|
+
def self.method_missing(method, *args)
|
14
|
+
method_name = method.to_s
|
15
|
+
super(method, *args)
|
16
|
+
|
17
|
+
rescue NoMethodError
|
18
|
+
#set a value for a variable
|
19
|
+
if method_name =~ /=$/
|
20
|
+
var_name = method_name.gsub('=', '')
|
21
|
+
value = args.first
|
22
|
+
self[var_name] = value
|
23
|
+
|
24
|
+
#retrieve a value
|
25
|
+
else
|
26
|
+
self[method_name]
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
#destroy the specified settings record
|
32
|
+
def self.destroy(var_name)
|
33
|
+
var_name = var_name.to_s
|
34
|
+
if self[var_name]
|
35
|
+
object(var_name).destroy
|
36
|
+
true
|
37
|
+
else
|
38
|
+
raise SettingNotFound, "Setting variable \"#{var_name}\" not found"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
#retrieve all settings as a hash
|
43
|
+
def self.all
|
44
|
+
vars = find(:all, :select => 'var, value')
|
45
|
+
|
46
|
+
result = {}
|
47
|
+
vars.each do |record|
|
48
|
+
result[record.var] = record.value
|
49
|
+
end
|
50
|
+
result.with_indifferent_access
|
51
|
+
end
|
52
|
+
|
53
|
+
#retrieve a setting value by [] notation
|
54
|
+
def self.[](var_name)
|
55
|
+
if var = object(var_name)
|
56
|
+
var.value
|
57
|
+
elsif @@defaults[var_name.to_s]
|
58
|
+
@@defaults[var_name.to_s]
|
59
|
+
else
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
#set a setting value by [] notation
|
65
|
+
def self.[]=(var_name, value)
|
66
|
+
var_name = var_name.to_s
|
67
|
+
|
68
|
+
record = object(var_name) || Settings.new(:var => var_name)
|
69
|
+
record.value = value
|
70
|
+
record.save
|
71
|
+
end
|
72
|
+
|
73
|
+
#retrieve the actual Setting record
|
74
|
+
def self.object(var_name)
|
75
|
+
Settings.find_by_var(var_name.to_s)
|
76
|
+
end
|
77
|
+
|
78
|
+
#get the value field, YAML decoded
|
79
|
+
def value
|
80
|
+
YAML::load(self[:value])
|
81
|
+
end
|
82
|
+
|
83
|
+
#set the value field, YAML encoded
|
84
|
+
def value=(new_value)
|
85
|
+
self[:value] = new_value.to_yaml
|
86
|
+
end
|
87
|
+
|
88
|
+
#Deprecated!
|
89
|
+
def self.reload # :nodoc:
|
90
|
+
self
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<% remote_form_for(:settings, :url => admin_settings_path, :method => :put, :html => {:class => 'setting-form'} ) do |f| %>
|
2
|
+
|
3
|
+
<% settings.each do |setting| %>
|
4
|
+
|
5
|
+
<p>
|
6
|
+
<% unless setting.empty? %>
|
7
|
+
<%= f.label setting[0] %><br/>
|
8
|
+
|
9
|
+
<% unless setting[2].blank? %>
|
10
|
+
<span class="setting-description"><%= setting[2] %></span><br/>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= case setting[1]
|
14
|
+
when "text"
|
15
|
+
f.text_field setting[0]
|
16
|
+
when "text_area"
|
17
|
+
f.text_area setting[0], :rows => 3
|
18
|
+
when "checkbox"
|
19
|
+
f.check_box setting[0]
|
20
|
+
else
|
21
|
+
nil
|
22
|
+
end %>
|
23
|
+
</p>
|
24
|
+
|
25
|
+
<% else %>
|
26
|
+
<br />
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<% end %>
|
30
|
+
<%= f.submit "Set", :disable_with => 'Setting...' %>
|
31
|
+
<% end -%>
|
@@ -0,0 +1 @@
|
|
1
|
+
flash_messages_js(page)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<h1>Listing Users</h1>
|
2
|
+
|
3
|
+
<ul class="choices">
|
4
|
+
<li><%= link_to 'Create New User', new_admin_user_path %></li>
|
5
|
+
</ul>
|
6
|
+
|
7
|
+
<%= will_paginate @users %>
|
8
|
+
|
9
|
+
<table>
|
10
|
+
<thead>
|
11
|
+
<tr>
|
12
|
+
<%= sortable_table_header :name => "Name", :sort => "title" %>
|
13
|
+
<%= sortable_table_header :name => "Email", :sort => "email" %>
|
14
|
+
<%= sortable_table_header :name => "Role", :sort => "role" %>
|
15
|
+
<th colspan="2">Actions</th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
<tbody>
|
19
|
+
<% for user in @users -%>
|
20
|
+
<tr>
|
21
|
+
<td><%=h user.name %></td>
|
22
|
+
<td><%=h user.email %></td>
|
23
|
+
<td><%=h user.role %></td>
|
24
|
+
<td><%= link_to 'Edit', [:admin, user], :class => 'edit' %></td>
|
25
|
+
<td><%= link_to 'Destroy', [:admin, user], :confirm => 'Are you sure?', :method => :delete, :class => 'delete' %></td>
|
26
|
+
</tr>
|
27
|
+
<% end %>
|
28
|
+
</tbody>
|
29
|
+
<tfoot>
|
30
|
+
<tr>
|
31
|
+
<%= sortable_table_header :name => "Name", :sort => "title" %>
|
32
|
+
<%= sortable_table_header :name => "Email", :sort => "email" %>
|
33
|
+
<%= sortable_table_header :name => "Role", :sort => "role" %>
|
34
|
+
<th colspan="2">Actions</th>
|
35
|
+
</tr>
|
36
|
+
</tfoot>
|
37
|
+
</table>
|
38
|
+
|
39
|
+
<%= will_paginate @users %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<h1><%= @user.new_record? ? 'New' : 'Editing' %> User</h1>
|
2
|
+
|
3
|
+
<% form_for([:admin, @user], :html => {:multipart => true} ) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= f.label :name %><br/>
|
8
|
+
<%= f.text_field :name %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= f.label :email %><br/>
|
13
|
+
<%= f.text_field :email %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<%= f.label :password %><br/>
|
18
|
+
<%= f.password_field :password, :id => "password", :onKeyUp => "updateStrength(this.value)" %>
|
19
|
+
<div id="password-meter"><strong>Strength</strong><div id = "psContainer"><div id = "psStrength"></div></div></div>
|
20
|
+
</p>
|
21
|
+
|
22
|
+
<p>
|
23
|
+
<%= f.label :password_confirmation, "Attribute" %><br/>
|
24
|
+
<%= f.password_field :password_confirmation %>
|
25
|
+
</p>
|
26
|
+
|
27
|
+
<p>
|
28
|
+
<%= f.label :role %><br/>
|
29
|
+
<%= f.select :role, User::ROLES %>
|
30
|
+
</p>
|
31
|
+
|
32
|
+
<p>
|
33
|
+
<%= f.submit "Save", :disable_with => 'Saving...' %> or <%= link_to 'Cancel', admin_users_path %>
|
34
|
+
</p>
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
5
|
+
<head>
|
6
|
+
<!-- START META TAGS -->
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
8
|
+
<meta http-equiv="content-language" content="en" />
|
9
|
+
<meta name="MSSmartTagsPreventParsing" content="true" />
|
10
|
+
<meta name="copyright" content="<%= Time.now.year %>, Beef" />
|
11
|
+
<meta name="web-author" content="Beef (www.wearebeef.co.uk)" />
|
12
|
+
<meta name="author" content="Beef"/>
|
13
|
+
|
14
|
+
<!-- END META TAGS -->
|
15
|
+
<title><%= Settings.site_name %> | CMS | <%= admin_page_title %></title>
|
16
|
+
|
17
|
+
<%= stylesheet_link_tag 'admin/screen', 'textile-editor', :media=>'screen,tv,projection' %>
|
18
|
+
<%= stylesheet_link_tag 'admin/print', :media=>'print' %>
|
19
|
+
<%= stylesheet_link_tag 'admin/handheld', :media=>'handheld' %>
|
20
|
+
<!--[if IE]><link href="/stylesheets/admin/ie.css" media="screen" rel="Stylesheet" type="text/css" /><![endif]-->
|
21
|
+
|
22
|
+
<%= javascript_include_tag 'prototype', 'effects', 'dragdrop', 'controls', 'admin/application', 'textile-editor' %>
|
23
|
+
|
24
|
+
<%= @content_for_header %>
|
25
|
+
|
26
|
+
</head>
|
27
|
+
<body id="<%= self.controller_name %>" class="<%= self.action_name %>">
|
28
|
+
<!-- begin screen -->
|
29
|
+
<div id="screen">
|
30
|
+
<!-- begin header -->
|
31
|
+
<div id="header">
|
32
|
+
<h1><strong><%= Settings.site_name %></strong> Content Management System</h1>
|
33
|
+
<ul id="status">
|
34
|
+
<% if signed_in? %><li class="no_bull"><%= current_user.name %> is logged in</li><% end %>
|
35
|
+
<li><%= link_to 'Logout', session_path, :method => :delete %></li>
|
36
|
+
<%= tab 'Users', admin_users_path, :admin %>
|
37
|
+
<%= tab 'Settings', admin_settings_path if current_user.admin? %>
|
38
|
+
<li><%= link_to 'Live Site', '/' %></li>
|
39
|
+
</ul>
|
40
|
+
</div>
|
41
|
+
<!-- end header -->
|
42
|
+
<!-- begin navigation -->
|
43
|
+
<ul id="topnav">
|
44
|
+
<%= tab 'Dashboard', admin_path %>
|
45
|
+
<%= admin_menu_items %>
|
46
|
+
</ul>
|
47
|
+
<!-- end navigation -->
|
48
|
+
|
49
|
+
<%= flash_messages %>
|
50
|
+
|
51
|
+
<div id="content-area">
|
52
|
+
<div id="main-content">
|
53
|
+
<%= yield %>
|
54
|
+
</div>
|
55
|
+
<div id="sub-content">
|
56
|
+
<%= yield :sub_content %>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<!-- begin footer -->
|
61
|
+
<div id="footer">
|
62
|
+
<p>© <%= Time.now.year %> Beef • <%= mail_to 'support@wearebeef.co.uk' %></p>
|
63
|
+
</div>
|
64
|
+
<!-- end footer -->
|
65
|
+
</div>
|
66
|
+
<!-- end screen -->
|
67
|
+
</body>
|
68
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
|
2
|
+
|
3
|
+
class AdminAreaFilesGenerator < Rails::Generator::Base
|
4
|
+
|
5
|
+
def manifest
|
6
|
+
record do |m|
|
7
|
+
|
8
|
+
m.insert_into 'app/models/user.rb', <<-RUBY
|
9
|
+
# List of allowed roles. Removing admin role will cause errors
|
10
|
+
ROLES = [:team_member, :admin]
|
11
|
+
include Beef::AdminArea::Roles
|
12
|
+
|
13
|
+
attr_accessible :name
|
14
|
+
validates_presence_of :name
|
15
|
+
RUBY
|
16
|
+
|
17
|
+
|
18
|
+
m.directory File.join("public", "images", "admin")
|
19
|
+
m.directory File.join("public", "images", "textile-editor")
|
20
|
+
m.directory File.join("public", "images", "lightwindow")
|
21
|
+
m.directory File.join("public", "javascripts", "admin")
|
22
|
+
m.directory File.join("public", "stylesheets", "admin")
|
23
|
+
m.directory File.join("lib", "tasks")
|
24
|
+
m.directory File.join("app", "views", "admin", "settings")
|
25
|
+
|
26
|
+
["public/images/admin/accept_button.gif",
|
27
|
+
"public/images/admin/add.png",
|
28
|
+
"public/images/admin/application_cascade.png",
|
29
|
+
"public/images/admin/arrow_left.gif",
|
30
|
+
"public/images/admin/arrow_right.gif",
|
31
|
+
"public/images/admin/button_bg.gif",
|
32
|
+
"public/images/admin/cancel_button.gif",
|
33
|
+
"public/images/admin/cursor_arrow.gif",
|
34
|
+
"public/images/admin/delete_button.gif",
|
35
|
+
"public/images/admin/down_icon.gif",
|
36
|
+
"public/images/admin/edit_button.gif",
|
37
|
+
"public/images/admin/file-uploads.png",
|
38
|
+
"public/images/admin/folder.png",
|
39
|
+
"public/images/admin/folder_image.png",
|
40
|
+
"public/images/admin/head_bg.gif",
|
41
|
+
"public/images/admin/image_add.png",
|
42
|
+
"public/images/admin/images-pointer.png",
|
43
|
+
"public/images/admin/info_bg.gif",
|
44
|
+
"public/images/admin/nav_bg.gif",
|
45
|
+
"public/images/admin/over_button_bg.gif",
|
46
|
+
"public/images/admin/page_bg.gif",
|
47
|
+
"public/images/admin/page_white.png",
|
48
|
+
"public/images/admin/page_white_get.png",
|
49
|
+
"public/images/admin/page_white_link.png",
|
50
|
+
"public/images/admin/page_white_stack.png",
|
51
|
+
"public/images/admin/picture.png",
|
52
|
+
"public/images/admin/picture_medium.png",
|
53
|
+
"public/images/admin/picture_square.png",
|
54
|
+
"public/images/admin/picture_thumb.png",
|
55
|
+
"public/images/admin/pictures.png",
|
56
|
+
"public/images/admin/unapproved.png",
|
57
|
+
"public/images/admin/up_icon.gif",
|
58
|
+
"public/images/lightwindow/ajax-loading.gif",
|
59
|
+
"public/images/lightwindow/arrow-down.gif",
|
60
|
+
"public/images/lightwindow/arrow-up.gif",
|
61
|
+
"public/images/lightwindow/black-70.png",
|
62
|
+
"public/images/lightwindow/black.png",
|
63
|
+
"public/images/lightwindow/nextlabel.gif",
|
64
|
+
"public/images/lightwindow/pattern_148-70.png",
|
65
|
+
"public/images/lightwindow/pattern_148.gif",
|
66
|
+
"public/images/lightwindow/prevlabel.gif",
|
67
|
+
"public/images/textile-editor/background.png",
|
68
|
+
"public/images/textile-editor/blockquote.png",
|
69
|
+
"public/images/textile-editor/bold.png",
|
70
|
+
"public/images/textile-editor/center.png",
|
71
|
+
"public/images/textile-editor/h1.png",
|
72
|
+
"public/images/textile-editor/h2.png",
|
73
|
+
"public/images/textile-editor/h3.png",
|
74
|
+
"public/images/textile-editor/h4.png",
|
75
|
+
"public/images/textile-editor/h5.png",
|
76
|
+
"public/images/textile-editor/h6.png",
|
77
|
+
"public/images/textile-editor/indent.png",
|
78
|
+
"public/images/textile-editor/italic.png",
|
79
|
+
"public/images/textile-editor/justify.png",
|
80
|
+
"public/images/textile-editor/left.png",
|
81
|
+
"public/images/textile-editor/link.png",
|
82
|
+
"public/images/textile-editor/list_bullets.png",
|
83
|
+
"public/images/textile-editor/list_numbers.png",
|
84
|
+
"public/images/textile-editor/omega.png",
|
85
|
+
"public/images/textile-editor/outdent.png",
|
86
|
+
"public/images/textile-editor/paragraph.png",
|
87
|
+
"public/images/textile-editor/preview.png",
|
88
|
+
"public/images/textile-editor/right.png",
|
89
|
+
"public/images/textile-editor/strikethrough.png",
|
90
|
+
"public/images/textile-editor/underline.png",
|
91
|
+
"public/javascripts/admin/application.js",
|
92
|
+
"public/javascripts/lightwindow.js",
|
93
|
+
"public/javascripts/textile-editor-config.js",
|
94
|
+
"public/javascripts/textile-editor.js",
|
95
|
+
"public/stylesheets/admin/handheld.css",
|
96
|
+
"public/stylesheets/admin/ie.css",
|
97
|
+
"public/stylesheets/admin/print.css",
|
98
|
+
"public/stylesheets/admin/screen.css",
|
99
|
+
"public/stylesheets/admin/theme-1.0.css",
|
100
|
+
"public/stylesheets/lightwindow.css",
|
101
|
+
"public/stylesheets/textile-editor.css",
|
102
|
+
"app/models/content_sweeper.rb",
|
103
|
+
"lib/tasks/admin_area.rake",
|
104
|
+
"config/initializers/settings.rb",
|
105
|
+
"config/initializers/admin_area.rb",
|
106
|
+
"app/views/admin/settings/show.html.erb"].each do |file|
|
107
|
+
m.file file, file
|
108
|
+
end
|
109
|
+
|
110
|
+
m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => 'create_settings_and_users'
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Mostly pinched from http://github.com/ryanb/nifty-generators/tree/master
|
2
|
+
Rails::Generator::Commands::Base.class_eval do
|
3
|
+
def file_contains?(relative_destination, line)
|
4
|
+
File.read(destination_path(relative_destination)).include?(line)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
Rails::Generator::Commands::Create.class_eval do
|
9
|
+
|
10
|
+
def press_any_key(read_me="Where's the any key?")
|
11
|
+
puts read_me
|
12
|
+
gets
|
13
|
+
end
|
14
|
+
|
15
|
+
def insert_into(file, line)
|
16
|
+
logger.insert "#{line} into #{file}"
|
17
|
+
unless options[:pretend] || file_contains?(file, line)
|
18
|
+
gsub_file file, /^(class|module) .+$/ do |match|
|
19
|
+
"#{match}\n #{line}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
Rails::Generator::Commands::Destroy.class_eval do
|
27
|
+
|
28
|
+
def press_any_key
|
29
|
+
# do ni
|
30
|
+
end
|
31
|
+
|
32
|
+
def insert_into(file, line)
|
33
|
+
logger.remove "#{line} from #{file}"
|
34
|
+
unless options[:pretend]
|
35
|
+
gsub_file file, "\n #{line}", ''
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
Rails::Generator::Commands::List.class_eval do
|
42
|
+
|
43
|
+
def insert_into(file, line)
|
44
|
+
logger.insert "#{line} into #{file}"
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|