beef-admin_area 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/.document +5 -0
  2. data/.gitignore +5 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +7 -0
  5. data/Rakefile +59 -0
  6. data/VERSION +1 -0
  7. data/admin_area.gemspec +168 -0
  8. data/app/controllers/admin/base_controller.rb +8 -0
  9. data/app/controllers/admin/settings_controller.rb +43 -0
  10. data/app/controllers/admin/users_controller.rb +74 -0
  11. data/app/helpers/admin/base_helper.rb +59 -0
  12. data/app/helpers/admin/settings_helper.rb +8 -0
  13. data/app/helpers/admin/users_helper.rb +2 -0
  14. data/app/models/settings.rb +92 -0
  15. data/app/views/admin/base/index.html.erb +2 -0
  16. data/app/views/admin/settings/_form.html.erb +31 -0
  17. data/app/views/admin/settings/update.js.rjs +1 -0
  18. data/app/views/admin/users/index.html.erb +39 -0
  19. data/app/views/admin/users/show.html.erb +37 -0
  20. data/app/views/layouts/admin.html.erb +68 -0
  21. data/config/routes.rb +8 -0
  22. data/generators/admin_area_files/USAGE +8 -0
  23. data/generators/admin_area_files/admin_area_files_generator.rb +114 -0
  24. data/generators/admin_area_files/lib/insert_commands.rb +47 -0
  25. data/generators/admin_area_files/templates/app/models/content_sweeper.rb +43 -0
  26. data/generators/admin_area_files/templates/app/views/admin/settings/show.html.erb +52 -0
  27. data/generators/admin_area_files/templates/config/initializers/admin_area.rb +2 -0
  28. data/generators/admin_area_files/templates/config/initializers/settings.rb +8 -0
  29. data/generators/admin_area_files/templates/lib/tasks/admin_area.rake +10 -0
  30. data/generators/admin_area_files/templates/migration.rb +21 -0
  31. data/generators/admin_area_files/templates/public/images/admin/accept_button.gif +0 -0
  32. data/generators/admin_area_files/templates/public/images/admin/add.png +0 -0
  33. data/generators/admin_area_files/templates/public/images/admin/application_cascade.png +0 -0
  34. data/generators/admin_area_files/templates/public/images/admin/arrow_left.gif +0 -0
  35. data/generators/admin_area_files/templates/public/images/admin/arrow_right.gif +0 -0
  36. data/generators/admin_area_files/templates/public/images/admin/button_bg.gif +0 -0
  37. data/generators/admin_area_files/templates/public/images/admin/cancel_button.gif +0 -0
  38. data/generators/admin_area_files/templates/public/images/admin/cursor_arrow.gif +0 -0
  39. data/generators/admin_area_files/templates/public/images/admin/delete_button.gif +0 -0
  40. data/generators/admin_area_files/templates/public/images/admin/down_icon.gif +0 -0
  41. data/generators/admin_area_files/templates/public/images/admin/edit_button.gif +0 -0
  42. data/generators/admin_area_files/templates/public/images/admin/file-uploads.png +0 -0
  43. data/generators/admin_area_files/templates/public/images/admin/folder.png +0 -0
  44. data/generators/admin_area_files/templates/public/images/admin/folder_image.png +0 -0
  45. data/generators/admin_area_files/templates/public/images/admin/head_bg.gif +0 -0
  46. data/generators/admin_area_files/templates/public/images/admin/image_add.png +0 -0
  47. data/generators/admin_area_files/templates/public/images/admin/images-pointer.png +0 -0
  48. data/generators/admin_area_files/templates/public/images/admin/info_bg.gif +0 -0
  49. data/generators/admin_area_files/templates/public/images/admin/nav_bg.gif +0 -0
  50. data/generators/admin_area_files/templates/public/images/admin/over_button_bg.gif +0 -0
  51. data/generators/admin_area_files/templates/public/images/admin/page_bg.gif +0 -0
  52. data/generators/admin_area_files/templates/public/images/admin/page_white.png +0 -0
  53. data/generators/admin_area_files/templates/public/images/admin/page_white_get.png +0 -0
  54. data/generators/admin_area_files/templates/public/images/admin/page_white_link.png +0 -0
  55. data/generators/admin_area_files/templates/public/images/admin/page_white_stack.png +0 -0
  56. data/generators/admin_area_files/templates/public/images/admin/picture.png +0 -0
  57. data/generators/admin_area_files/templates/public/images/admin/picture_medium.png +0 -0
  58. data/generators/admin_area_files/templates/public/images/admin/picture_square.png +0 -0
  59. data/generators/admin_area_files/templates/public/images/admin/picture_thumb.png +0 -0
  60. data/generators/admin_area_files/templates/public/images/admin/pictures.png +0 -0
  61. data/generators/admin_area_files/templates/public/images/admin/unapproved.png +0 -0
  62. data/generators/admin_area_files/templates/public/images/admin/up_icon.gif +0 -0
  63. data/generators/admin_area_files/templates/public/images/lightwindow/Thumbs.db +0 -0
  64. data/generators/admin_area_files/templates/public/images/lightwindow/ajax-loading.gif +0 -0
  65. data/generators/admin_area_files/templates/public/images/lightwindow/arrow-down.gif +0 -0
  66. data/generators/admin_area_files/templates/public/images/lightwindow/arrow-up.gif +0 -0
  67. data/generators/admin_area_files/templates/public/images/lightwindow/black-70.png +0 -0
  68. data/generators/admin_area_files/templates/public/images/lightwindow/black.png +0 -0
  69. data/generators/admin_area_files/templates/public/images/lightwindow/nextlabel.gif +0 -0
  70. data/generators/admin_area_files/templates/public/images/lightwindow/pattern_148-70.png +0 -0
  71. data/generators/admin_area_files/templates/public/images/lightwindow/pattern_148.gif +0 -0
  72. data/generators/admin_area_files/templates/public/images/lightwindow/prevlabel.gif +0 -0
  73. data/generators/admin_area_files/templates/public/images/textile-editor/background.png +0 -0
  74. data/generators/admin_area_files/templates/public/images/textile-editor/blockquote.png +0 -0
  75. data/generators/admin_area_files/templates/public/images/textile-editor/bold.png +0 -0
  76. data/generators/admin_area_files/templates/public/images/textile-editor/center.png +0 -0
  77. data/generators/admin_area_files/templates/public/images/textile-editor/h1.png +0 -0
  78. data/generators/admin_area_files/templates/public/images/textile-editor/h2.png +0 -0
  79. data/generators/admin_area_files/templates/public/images/textile-editor/h3.png +0 -0
  80. data/generators/admin_area_files/templates/public/images/textile-editor/h4.png +0 -0
  81. data/generators/admin_area_files/templates/public/images/textile-editor/h5.png +0 -0
  82. data/generators/admin_area_files/templates/public/images/textile-editor/h6.png +0 -0
  83. data/generators/admin_area_files/templates/public/images/textile-editor/indent.png +0 -0
  84. data/generators/admin_area_files/templates/public/images/textile-editor/italic.png +0 -0
  85. data/generators/admin_area_files/templates/public/images/textile-editor/justify.png +0 -0
  86. data/generators/admin_area_files/templates/public/images/textile-editor/left.png +0 -0
  87. data/generators/admin_area_files/templates/public/images/textile-editor/link.png +0 -0
  88. data/generators/admin_area_files/templates/public/images/textile-editor/list_bullets.png +0 -0
  89. data/generators/admin_area_files/templates/public/images/textile-editor/list_numbers.png +0 -0
  90. data/generators/admin_area_files/templates/public/images/textile-editor/omega.png +0 -0
  91. data/generators/admin_area_files/templates/public/images/textile-editor/outdent.png +0 -0
  92. data/generators/admin_area_files/templates/public/images/textile-editor/paragraph.png +0 -0
  93. data/generators/admin_area_files/templates/public/images/textile-editor/preview.png +0 -0
  94. data/generators/admin_area_files/templates/public/images/textile-editor/right.png +0 -0
  95. data/generators/admin_area_files/templates/public/images/textile-editor/strikethrough.png +0 -0
  96. data/generators/admin_area_files/templates/public/images/textile-editor/underline.png +0 -0
  97. data/generators/admin_area_files/templates/public/javascripts/admin/application.js +185 -0
  98. data/generators/admin_area_files/templates/public/javascripts/lightwindow.js +1921 -0
  99. data/generators/admin_area_files/templates/public/javascripts/textile-editor-config.js +107 -0
  100. data/generators/admin_area_files/templates/public/javascripts/textile-editor.js +788 -0
  101. data/generators/admin_area_files/templates/public/stylesheets/admin/handheld.css +6 -0
  102. data/generators/admin_area_files/templates/public/stylesheets/admin/ie.css +21 -0
  103. data/generators/admin_area_files/templates/public/stylesheets/admin/print.css +27 -0
  104. data/generators/admin_area_files/templates/public/stylesheets/admin/screen.css +996 -0
  105. data/generators/admin_area_files/templates/public/stylesheets/admin/theme-1.0.css +131 -0
  106. data/generators/admin_area_files/templates/public/stylesheets/lightwindow.css +376 -0
  107. data/generators/admin_area_files/templates/public/stylesheets/textile-editor.css +60 -0
  108. data/generators/admin_scaffold/USAGE +8 -0
  109. data/generators/admin_scaffold/admin_scaffold_generator.rb +53 -0
  110. data/generators/admin_scaffold/lib/insert_commands.rb +61 -0
  111. data/generators/admin_scaffold/templates/admin_controller.rb +83 -0
  112. data/generators/admin_scaffold/templates/admin_index.html.erb +38 -0
  113. data/generators/admin_scaffold/templates/admin_show.html.erb +16 -0
  114. data/generators/admin_scaffold/templates/helper.rb +2 -0
  115. data/generators/admin_scaffold/templates/helper_test.rb +4 -0
  116. data/generators/admin_scaffold/templates/layout.html.erb +17 -0
  117. data/generators/admin_scaffold/templates/style.css +54 -0
  118. data/generators/admin_scaffold/templates/view_controller.rb +14 -0
  119. data/generators/admin_scaffold/templates/view_index.html.erb +17 -0
  120. data/lib/admin_area.rb +82 -0
  121. data/rails/init.rb +4 -0
  122. data/test/admin_area_test.rb +7 -0
  123. data/test/test_helper.rb +10 -0
  124. metadata +206 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Steve England
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,7 @@
1
+ = admin_area
2
+
3
+ Description goes here.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2009 Steve England. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,59 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "admin_area"
8
+ gem.summary = %Q{Rails engine that provides a standard admin area with user managament}
9
+ gem.email = "steve@wearebeef.co.uk"
10
+ gem.homepage = "http://github.com/beef/admin"
11
+ gem.authors = ["Steve England"]
12
+ gem.add_dependency("thoughtbot-clearance", [">= 0.6.6"])
13
+ gem.add_dependency("thoughtbot-sortable_table")
14
+ gem.add_dependency("mislav-will_paginate", ['>= 2.3.8'])
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
20
+ end
21
+
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |test|
24
+ test.libs << 'lib' << 'test'
25
+ test.pattern = 'test/**/*_test.rb'
26
+ test.verbose = true
27
+ end
28
+
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/*_test.rb'
34
+ test.verbose = true
35
+ end
36
+ rescue LoadError
37
+ task :rcov do
38
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
+ end
40
+ end
41
+
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ if File.exist?('VERSION.yml')
48
+ config = YAML.load(File.read('VERSION.yml'))
49
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
50
+ else
51
+ version = ""
52
+ end
53
+
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "admin_area #{version}"
56
+ rdoc.rdoc_files.include('README*')
57
+ rdoc.rdoc_files.include('lib/**/*.rb')
58
+ end
59
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,168 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{admin_area}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Steve England"]
9
+ s.date = %q{2009-06-24}
10
+ s.email = %q{steve@wearebeef.co.uk}
11
+ s.extra_rdoc_files = [
12
+ "LICENSE",
13
+ "README.rdoc"
14
+ ]
15
+ s.files = [
16
+ ".document",
17
+ ".gitignore",
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "admin_area.gemspec",
23
+ "app/controllers/admin/base_controller.rb",
24
+ "app/controllers/admin/settings_controller.rb",
25
+ "app/controllers/admin/users_controller.rb",
26
+ "app/helpers/admin/base_helper.rb",
27
+ "app/helpers/admin/settings_helper.rb",
28
+ "app/helpers/admin/users_helper.rb",
29
+ "app/models/settings.rb",
30
+ "app/views/admin/base/index.html.erb",
31
+ "app/views/admin/settings/_form.html.erb",
32
+ "app/views/admin/settings/update.js.rjs",
33
+ "app/views/admin/users/index.html.erb",
34
+ "app/views/admin/users/show.html.erb",
35
+ "app/views/layouts/admin.html.erb",
36
+ "config/routes.rb",
37
+ "generators/admin_area_files/USAGE",
38
+ "generators/admin_area_files/admin_area_files_generator.rb",
39
+ "generators/admin_area_files/lib/insert_commands.rb",
40
+ "generators/admin_area_files/templates/app/models/content_sweeper.rb",
41
+ "generators/admin_area_files/templates/app/views/admin/settings/show.html.erb",
42
+ "generators/admin_area_files/templates/config/initializers/admin_area.rb",
43
+ "generators/admin_area_files/templates/config/initializers/settings.rb",
44
+ "generators/admin_area_files/templates/lib/tasks/admin_area.rake",
45
+ "generators/admin_area_files/templates/migration.rb",
46
+ "generators/admin_area_files/templates/public/images/admin/accept_button.gif",
47
+ "generators/admin_area_files/templates/public/images/admin/add.png",
48
+ "generators/admin_area_files/templates/public/images/admin/application_cascade.png",
49
+ "generators/admin_area_files/templates/public/images/admin/arrow_left.gif",
50
+ "generators/admin_area_files/templates/public/images/admin/arrow_right.gif",
51
+ "generators/admin_area_files/templates/public/images/admin/button_bg.gif",
52
+ "generators/admin_area_files/templates/public/images/admin/cancel_button.gif",
53
+ "generators/admin_area_files/templates/public/images/admin/cursor_arrow.gif",
54
+ "generators/admin_area_files/templates/public/images/admin/delete_button.gif",
55
+ "generators/admin_area_files/templates/public/images/admin/down_icon.gif",
56
+ "generators/admin_area_files/templates/public/images/admin/edit_button.gif",
57
+ "generators/admin_area_files/templates/public/images/admin/file-uploads.png",
58
+ "generators/admin_area_files/templates/public/images/admin/folder.png",
59
+ "generators/admin_area_files/templates/public/images/admin/folder_image.png",
60
+ "generators/admin_area_files/templates/public/images/admin/head_bg.gif",
61
+ "generators/admin_area_files/templates/public/images/admin/image_add.png",
62
+ "generators/admin_area_files/templates/public/images/admin/images-pointer.png",
63
+ "generators/admin_area_files/templates/public/images/admin/info_bg.gif",
64
+ "generators/admin_area_files/templates/public/images/admin/nav_bg.gif",
65
+ "generators/admin_area_files/templates/public/images/admin/over_button_bg.gif",
66
+ "generators/admin_area_files/templates/public/images/admin/page_bg.gif",
67
+ "generators/admin_area_files/templates/public/images/admin/page_white.png",
68
+ "generators/admin_area_files/templates/public/images/admin/page_white_get.png",
69
+ "generators/admin_area_files/templates/public/images/admin/page_white_link.png",
70
+ "generators/admin_area_files/templates/public/images/admin/page_white_stack.png",
71
+ "generators/admin_area_files/templates/public/images/admin/picture.png",
72
+ "generators/admin_area_files/templates/public/images/admin/picture_medium.png",
73
+ "generators/admin_area_files/templates/public/images/admin/picture_square.png",
74
+ "generators/admin_area_files/templates/public/images/admin/picture_thumb.png",
75
+ "generators/admin_area_files/templates/public/images/admin/pictures.png",
76
+ "generators/admin_area_files/templates/public/images/admin/unapproved.png",
77
+ "generators/admin_area_files/templates/public/images/admin/up_icon.gif",
78
+ "generators/admin_area_files/templates/public/images/lightwindow/Thumbs.db",
79
+ "generators/admin_area_files/templates/public/images/lightwindow/ajax-loading.gif",
80
+ "generators/admin_area_files/templates/public/images/lightwindow/arrow-down.gif",
81
+ "generators/admin_area_files/templates/public/images/lightwindow/arrow-up.gif",
82
+ "generators/admin_area_files/templates/public/images/lightwindow/black-70.png",
83
+ "generators/admin_area_files/templates/public/images/lightwindow/black.png",
84
+ "generators/admin_area_files/templates/public/images/lightwindow/nextlabel.gif",
85
+ "generators/admin_area_files/templates/public/images/lightwindow/pattern_148-70.png",
86
+ "generators/admin_area_files/templates/public/images/lightwindow/pattern_148.gif",
87
+ "generators/admin_area_files/templates/public/images/lightwindow/prevlabel.gif",
88
+ "generators/admin_area_files/templates/public/images/textile-editor/background.png",
89
+ "generators/admin_area_files/templates/public/images/textile-editor/blockquote.png",
90
+ "generators/admin_area_files/templates/public/images/textile-editor/bold.png",
91
+ "generators/admin_area_files/templates/public/images/textile-editor/center.png",
92
+ "generators/admin_area_files/templates/public/images/textile-editor/h1.png",
93
+ "generators/admin_area_files/templates/public/images/textile-editor/h2.png",
94
+ "generators/admin_area_files/templates/public/images/textile-editor/h3.png",
95
+ "generators/admin_area_files/templates/public/images/textile-editor/h4.png",
96
+ "generators/admin_area_files/templates/public/images/textile-editor/h5.png",
97
+ "generators/admin_area_files/templates/public/images/textile-editor/h6.png",
98
+ "generators/admin_area_files/templates/public/images/textile-editor/indent.png",
99
+ "generators/admin_area_files/templates/public/images/textile-editor/italic.png",
100
+ "generators/admin_area_files/templates/public/images/textile-editor/justify.png",
101
+ "generators/admin_area_files/templates/public/images/textile-editor/left.png",
102
+ "generators/admin_area_files/templates/public/images/textile-editor/link.png",
103
+ "generators/admin_area_files/templates/public/images/textile-editor/list_bullets.png",
104
+ "generators/admin_area_files/templates/public/images/textile-editor/list_numbers.png",
105
+ "generators/admin_area_files/templates/public/images/textile-editor/omega.png",
106
+ "generators/admin_area_files/templates/public/images/textile-editor/outdent.png",
107
+ "generators/admin_area_files/templates/public/images/textile-editor/paragraph.png",
108
+ "generators/admin_area_files/templates/public/images/textile-editor/preview.png",
109
+ "generators/admin_area_files/templates/public/images/textile-editor/right.png",
110
+ "generators/admin_area_files/templates/public/images/textile-editor/strikethrough.png",
111
+ "generators/admin_area_files/templates/public/images/textile-editor/underline.png",
112
+ "generators/admin_area_files/templates/public/javascripts/admin/application.js",
113
+ "generators/admin_area_files/templates/public/javascripts/lightwindow.js",
114
+ "generators/admin_area_files/templates/public/javascripts/textile-editor-config.js",
115
+ "generators/admin_area_files/templates/public/javascripts/textile-editor.js",
116
+ "generators/admin_area_files/templates/public/stylesheets/admin/handheld.css",
117
+ "generators/admin_area_files/templates/public/stylesheets/admin/ie.css",
118
+ "generators/admin_area_files/templates/public/stylesheets/admin/print.css",
119
+ "generators/admin_area_files/templates/public/stylesheets/admin/screen.css",
120
+ "generators/admin_area_files/templates/public/stylesheets/admin/theme-1.0.css",
121
+ "generators/admin_area_files/templates/public/stylesheets/lightwindow.css",
122
+ "generators/admin_area_files/templates/public/stylesheets/textile-editor.css",
123
+ "generators/admin_scaffold/USAGE",
124
+ "generators/admin_scaffold/admin_scaffold_generator.rb",
125
+ "generators/admin_scaffold/lib/insert_commands.rb",
126
+ "generators/admin_scaffold/templates/admin_controller.rb",
127
+ "generators/admin_scaffold/templates/admin_index.html.erb",
128
+ "generators/admin_scaffold/templates/admin_show.html.erb",
129
+ "generators/admin_scaffold/templates/helper.rb",
130
+ "generators/admin_scaffold/templates/helper_test.rb",
131
+ "generators/admin_scaffold/templates/layout.html.erb",
132
+ "generators/admin_scaffold/templates/style.css",
133
+ "generators/admin_scaffold/templates/view_controller.rb",
134
+ "generators/admin_scaffold/templates/view_index.html.erb",
135
+ "lib/admin_area.rb",
136
+ "rails/init.rb",
137
+ "test/admin_area_test.rb",
138
+ "test/test_helper.rb"
139
+ ]
140
+ s.homepage = %q{http://github.com/beef/admin}
141
+ s.rdoc_options = ["--charset=UTF-8"]
142
+ s.require_paths = ["lib"]
143
+ s.rubygems_version = %q{1.3.3}
144
+ s.summary = %q{Rails engine that provides a standard admin area with user managament}
145
+ s.test_files = [
146
+ "test/admin_area_test.rb",
147
+ "test/test_helper.rb"
148
+ ]
149
+
150
+ if s.respond_to? :specification_version then
151
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
152
+ s.specification_version = 3
153
+
154
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
155
+ s.add_runtime_dependency(%q<thoughtbot-clearance>, [">= 0.6.6"])
156
+ s.add_runtime_dependency(%q<thoughtbot-sortable_table>, [">= 0"])
157
+ s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.8"])
158
+ else
159
+ s.add_dependency(%q<thoughtbot-clearance>, [">= 0.6.6"])
160
+ s.add_dependency(%q<thoughtbot-sortable_table>, [">= 0"])
161
+ s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.8"])
162
+ end
163
+ else
164
+ s.add_dependency(%q<thoughtbot-clearance>, [">= 0.6.6"])
165
+ s.add_dependency(%q<thoughtbot-sortable_table>, [">= 0"])
166
+ s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.8"])
167
+ end
168
+ end
@@ -0,0 +1,8 @@
1
+ class Admin::BaseController < ApplicationController
2
+ include Beef::AdminArea::Authorisation
3
+ include SortableTable::App::Controllers::ApplicationController
4
+ layout 'admin'
5
+ before_filter :authenticate
6
+ cache_sweeper :content_sweeper, :only => [ :create, :update, :destroy ]
7
+
8
+ end
@@ -0,0 +1,43 @@
1
+ class Admin::SettingsController < Admin::BaseController
2
+
3
+ # rescue_from Flickr::APIError, :with => :flickr_error
4
+
5
+ def show
6
+ unless current_user.admin?
7
+ flash.now[:notice] = 'You may view settings but editing is only available to Adminstrators.'
8
+ end
9
+
10
+ @settings = Settings
11
+
12
+ # unless Settings.flickr_api_key.blank? or Settings.flickr_api_secret.blank?
13
+ # Flickr::API.connect Settings.flickr_api_key, Settings.flickr_api_secret, Settings.flickr_auth_token
14
+ # if @unauthorised = Flickr::API.unauthorised?
15
+ # @login_url = Flickr::API.login_url
16
+ # end
17
+ # end
18
+ end
19
+
20
+ def update
21
+ unless current_user.admin?
22
+ flash[:notice] = 'You may view settings but editing is only available to Adminstrators.'
23
+ else
24
+
25
+ params[:settings].each_pair do |key,value|
26
+ if(key =~ /(_api_key|_api_secret)/i)
27
+ value.strip!
28
+ end
29
+
30
+ Settings[key] = value.gsub(/^http\:\/\//i,'')
31
+ end
32
+
33
+ flash.now[:notice] = "Setting#{params[:settings].length>1?'s':''} #{params[:settings].collect{|s,v| s.humanize}.join(', ')} was successfully updated."
34
+ end
35
+
36
+ respond_to do |format|
37
+ format.html { redirect_to admin_setting_path}
38
+ format.js
39
+ end
40
+
41
+ end
42
+
43
+ end
@@ -0,0 +1,74 @@
1
+ class Admin::UsersController < Admin::BaseController
2
+ authorise :roles => :admin
3
+ sortable_attributes :name, :email, :role
4
+
5
+ # GET /users
6
+ # GET /users.xml
7
+ def index
8
+ @users = User.paginate :page => params[:page], :per_page => 20, :order => sort_order
9
+
10
+ respond_to do |format|
11
+ format.html # index.html.erb
12
+ format.xml { render :xml => @users }
13
+ end
14
+ end
15
+
16
+ # GET /users/new
17
+ # GET /users/new.xml
18
+ def new
19
+ @user = User.new
20
+ render :action => 'show'
21
+ end
22
+
23
+ # GET /users/1/edit
24
+ def show
25
+ @user = User.find(params[:id])
26
+ end
27
+
28
+ # POST /users
29
+ # POST /users.xml
30
+ def create
31
+ @user = User.new(params[:user])
32
+ # Because mass assignment is protected
33
+ @user.role = params[:user][:role]
34
+ respond_to do |format|
35
+ if @user.save
36
+ @user.confirm_email!
37
+ flash[:notice] = 'User was successfully created.'
38
+ format.html { redirect_to(admin_users_url) }
39
+ format.xml { render :xml => @user, :status => :created, :location => @user }
40
+ else
41
+ format.html { render :action => "show" }
42
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
43
+ end
44
+ end
45
+ end
46
+
47
+ # PUT /users/1
48
+ # PUT /users/1.xml
49
+ def update
50
+ @user = User.find(params[:id])
51
+ # Because mass assignment is protected
52
+ @user.role = params[:user][:role]
53
+ respond_to do |format|
54
+ if @user.update_attributes(params[:user])
55
+ flash[:notice] = 'User was successfully updated.'
56
+ format.html { redirect_to(admin_users_url) }
57
+ format.xml { head :ok }
58
+ else
59
+ format.html { render :action => "show" }
60
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
61
+ end
62
+ end
63
+ end
64
+
65
+ # DELETE /users/1
66
+ # DELETE /users/1.xml
67
+ def destroy
68
+ respond_to do |format|
69
+ format.html { redirect_to(admin_users_url) }
70
+ format.xml { head :ok }
71
+ end
72
+ end
73
+
74
+ end
@@ -0,0 +1,59 @@
1
+ module Admin::BaseHelper
2
+ include SortableTable::App::Helpers::ApplicationHelper
3
+
4
+ def admin_menu_items
5
+ tabs = Beef::AdminArea::ADMIN_MENU.map do | menu_item |
6
+ if menu_item.is_a? Hash
7
+ tab(menu_item[:title] || menu_item[:controller].to_s.titleize, send("admin_#{menu_item[:controller]}_path"), menu_item[:roles])
8
+ else
9
+ tab(menu_item.to_s.titleize, send("admin_#{menu_item}_path"))
10
+ end
11
+ end
12
+ tabs.join
13
+ end
14
+
15
+ def admin_page_title
16
+ @page_title ||= controller.controller_name.titleize + (controller.action_name == 'index' ? ' ' : " | #{controller.action_name.titleize}" )
17
+ end
18
+
19
+ def tab(label, options = {}, roles = nil)
20
+ return if roles and !current_user.authorised?(*roles)
21
+ content_tag :li, link_to(label, options)
22
+ end
23
+
24
+ def flash_messages
25
+ flash.collect do |name, message|
26
+ content_tag :div, message, :class => "flash #{name}"
27
+ end.join
28
+ end
29
+
30
+ # RJS helper for flash text
31
+ def flash_messages_js(page, element = 'content-area')
32
+ page.insert_html :before, element, flash_messages
33
+ page << 'init_flash_messages();'
34
+ end
35
+
36
+ def lastest_flickr
37
+ return if Settings.flickr_api_key.blank? or Settings.flickr_user_id.blank?
38
+ Flickr::API.connect Settings.flickr_api_key, Settings.flickr_api_secret, Settings.flickr_auth_token
39
+ flickr_params = { :per_page => '5', :page => params[:page], :user_id => Settings.flickr_user_id, :sort => 'date-taken-desc', :tag_mode => 'all' }
40
+ flickr_params[:tags] = params[:tags] unless params[:tags].blank?
41
+ flickr_result = Flickr::Photo.find(:all, flickr_params)
42
+ render :partial => 'admin/shared/flickr_latest.html.erb', :locals => { :flickr_images => flickr_result }
43
+ end
44
+
45
+ def flickr_select
46
+ return if Settings.flickr_api_key.blank? or Settings.flickr_user_id.blank?
47
+ Flickr::API.connect Settings.flickr_api_key, Settings.flickr_api_secret, Settings.flickr_auth_token
48
+ flickr_params = { :per_page => '12', :page => params[:page], :user_id => Settings.flickr_user_id, :sort => 'date-taken-desc', :tag_mode => 'all' }
49
+ flickr_params[:tags] = params[:tags] unless params[:tags].blank?
50
+ flickr_result = Flickr::Photo.find(:all, flickr_params)
51
+ render :partial => 'admin/shared/flickr.html.erb', :locals => { :flickr_images => flickr_result }
52
+ end
53
+
54
+ def preview_link(object)
55
+ url = url_for([:preview, :admin, object ])
56
+ link_to_function 'Preview', "new Ajax.Updater('page_preview', '#{url}', {asynchronous:true, evalScripts:true, parameters: this.up('form').serialize() + '&assets=' + getAssetIDs('asset-list')})", :class => 'button'
57
+ end
58
+
59
+ end