unknown_admin 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -15,16 +15,13 @@ Enjoy.
15
15
 
16
16
  In your Gemfile:
17
17
 
18
- ### Required for bootstrap (starting Rails 3.2.9)
18
+ ### Add to your asset-block:
19
19
 
20
- gem "therubyracer"
21
- gem "less-rails"
22
- gem "twitter-bootstrap-rails"
20
+ gem 'bootstrap-sass'
23
21
 
24
22
  ### Add the `unknown-admin` gem
25
23
 
26
- gem 'unknown_admin',:git=>"http://gitlab.unknown.de/unknown_admin.git"
27
-
24
+ gem 'unknown_admin'
28
25
 
29
26
  ## Installation
30
27
 
@@ -36,10 +33,6 @@ It is possible that v8 engine libraries need to be installed
36
33
 
37
34
  brew install v8
38
35
 
39
- Then run the boostrap generator to add Bootstrap includes into your assets:
40
-
41
- rails generate bootstrap:install less
42
-
43
36
  Also run the unknown_admin generator to install the asset files for the admin-backend
44
37
 
45
38
  rails generate unknown_admin:install
@@ -1,21 +1,10 @@
1
1
  module Admin
2
2
  class AdminController < ActionController::Base
3
3
 
4
- #before_filter :authenticate_user!
4
+
5
5
  protect_from_forgery
6
-
7
- layout :ajax_request
8
- #before_filter :authorize
9
-
10
- #delegate :allow?, to: :current_permission
11
6
  helper_method :allow?
12
-
13
- #delegate :allow_param?, to: :current_permission
14
- #helper_method :allow_param?
15
-
16
-
17
- #helper_method :current_domain
18
- helper_method :current_style
7
+ layout :ajax_request
19
8
 
20
9
 
21
10
 
@@ -24,37 +13,10 @@ module Admin
24
13
  request.xhr? ? "admin/ajax" : "admin/application"
25
14
  end
26
15
 
27
- ## TODO: Fix this
16
+ ### TODO: Add your Authentication method here!
28
17
  def allow?(*args)
29
18
  true
30
19
  end
31
-
32
- def current_domain
33
- @current_domain ||= Domain.find(session[:current_domain_id]) unless session[:current_domain_id].nil?
34
- end
35
- def current_style
36
- color = "#fff"
37
-
38
- templ=Tilt::ERBTemplate.new { "body { background-color:<%=color%>}" }
39
- return templ.render(self,:color=>color)
40
- end
41
-
42
- def current_permission
43
- @current_permission ||= Permissions.permission_for(current_user)
44
- end
45
-
46
- def current_resource
47
- nil
48
- end
49
-
50
- def authorize
51
- User.current=current_user
52
- if current_permission.allow?(params[:controller], params[:action], current_resource)
53
- current_permission.permit_params! params
54
- else
55
- render :text=> "Not authorized.",:status=>:unauthorized
56
- end
57
- end
58
-
20
+
59
21
  end
60
22
  end
@@ -0,0 +1,7 @@
1
+ module Admin
2
+ class HomeController < ActionController::Base
3
+ def index
4
+ render text: "Override Root-Path or HomeController to edit this page"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ module BootstrapFlashHelper
2
+ ALERT_TYPES = [:error, :info, :success, :warning]
3
+
4
+ def bootstrap_flash
5
+ flash_messages = []
6
+ flash.each do |type, message|
7
+ # Skip empty messages, e.g. for devise messages set to nothing in a locale file.
8
+ next if message.blank?
9
+
10
+ type = :success if type == :notice
11
+ type = :error if type == :alert
12
+ next unless ALERT_TYPES.include?(type)
13
+
14
+ Array(message).each do |msg|
15
+ text = content_tag(:div,
16
+ content_tag(:button, raw("&times;"), :class => "close", "data-dismiss" => "alert") +
17
+ msg.html_safe, :class => "alert fade in alert-#{type}")
18
+ flash_messages << text if msg
19
+ end
20
+ end
21
+ flash_messages.join("\n").html_safe
22
+ end
23
+ end
@@ -18,12 +18,6 @@
18
18
  <div class="span12">
19
19
  <%= yield %>
20
20
  </div>
21
-
22
- <div class="span3 hidden">
23
- <div id="detailColumn" >
24
- <%= yield :detail_column %>
25
- </div>
26
- </div>
27
21
  </div>
28
22
  </div>
29
23
  <div id="modal_container"></div>
data/config/routes.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  Rails.application.routes.draw do
2
2
  namespace :admin do
3
- resources :users do
3
+ resources :home,only:[:index] do
4
4
 
5
5
  end
6
- root :to =>"users#index"
6
+ root :to =>"home#index"
7
7
  end
8
8
  end
@@ -6,7 +6,7 @@ module UnknownAdmin
6
6
 
7
7
  source_root File.expand_path("../templates", __FILE__)
8
8
  desc "This generator creates a slim 'inherited-resources' controller"
9
- class_option :skip_routes, :type => :boolean, :default => "false",:desc=>"Skip adding resource/namespace to route file"
9
+ class_option :skip_routes, :type => :boolean, :default => false,:desc=>"Skip adding resource/namespace to route file"
10
10
  #argument :stylesheets_type, :type => :string, :default => 'less', :banner => '*less or static'
11
11
 
12
12
  def create_controller
@@ -9,9 +9,6 @@
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
10
  *
11
11
  *= require_self
12
- *= require bootstrap_and_overrides
13
- *= require bootstrap-datepicker
14
- *= require chosen
15
- *= require token-input-facebook
12
+ *= require bootstrap
16
13
  *= require_tree .
17
14
  */
@@ -13,8 +13,5 @@
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
15
  //= require jquery-ui
16
- //= require chosen-jquery
17
- //= require jquery.tokeninput
18
- //= require bootstrap-datepicker
19
- //= require twitter/bootstrap
16
+ //= require bootstrap
20
17
  //= require_tree .
@@ -1,63 +1,22 @@
1
1
  module Admin
2
2
  class AdminController < ActionController::Base
3
3
 
4
- #before_filter :authenticate_user!
4
+
5
5
  protect_from_forgery
6
-
7
- layout :ajax_request
8
- #before_filter :authorize
9
-
10
- #delegate :allow?, to: :current_permission
11
6
  helper_method :allow?
12
-
13
- #delegate :allow_param?, to: :current_permission
14
- #helper_method :allow_param?
15
-
16
-
17
- #helper_method :current_domain
18
- helper_method :current_style
7
+ layout :ajax_request
19
8
 
20
9
 
21
10
 
22
11
  private
23
12
  def ajax_request
24
-
25
- request.xhr? ? "admin/ajax" : "admin/application"
26
-
27
-
13
+ request.xhr? ? "admin/ajax" : "admin/application"
28
14
  end
29
15
 
30
- ## TODO: Fix this
16
+ ### TODO: Add your Authentication method here!
31
17
  def allow?(*args)
32
18
  true
33
19
  end
34
-
35
- def current_domain
36
- @current_domain ||= Domain.find(session[:current_domain_id]) unless session[:current_domain_id].nil?
37
- end
38
- def current_style
39
- color = "#fff"
40
-
41
- templ=Tilt::ERBTemplate.new { "body { background-color:<%=color%>}" }
42
- return templ.render(self,:color=>color)
43
- end
44
-
45
- def current_permission
46
- @current_permission ||= Permissions.permission_for(current_user)
47
- end
48
-
49
- def current_resource
50
- nil
51
- end
52
-
53
- def authorize
54
- User.current=current_user
55
- if current_permission.allow?(params[:controller], params[:action], current_resource)
56
- current_permission.permit_params! params
57
- else
58
- render :text=> "Not authorized.",:status=>:unauthorized
59
- end
60
- end
61
-
20
+
62
21
  end
63
22
  end
@@ -2,36 +2,22 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale = 1" />
5
- <title>B2kAdmin: <%= "#{params[:controller]}-#{params[:action]}" %></title>
5
+ <title>UnknownAdmin: <%= "#{params[:controller]}-#{params[:action]}" %></title>
6
6
  <%= stylesheet_link_tag "admin/admin", :media => "all" %>
7
7
  <%= javascript_include_tag "admin/admin" %>
8
8
  <style type="text/css" title="text/css">
9
- <%= current_style %>
10
9
  </style>
11
10
  <%= csrf_meta_tags %>
12
11
  </head>
13
12
  <body>
14
13
  <div class="container">
15
14
 
16
- <div class="navbar navbar-fixed-top">
17
- <div class="navbar-inner">
18
- <div class="container">
19
- <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a>
20
- <%= link_to "Unknown Admin", admin_root_url,class:"brand" %>
21
-
22
-
23
-
24
-
25
- </div>
26
- </div><!-- /navbar-inner -->
27
- </div>
15
+
28
16
  <%= bootstrap_flash %>
29
17
  <div class="row">
30
18
  <div class="span12">
31
19
  <%= yield %>
32
20
  </div>
33
-
34
-
35
21
  </div>
36
22
  </div>
37
23
  <div id="modal_container"></div>
@@ -1,3 +1,3 @@
1
1
  module UnknownAdmin
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/unknown_admin.rb CHANGED
@@ -5,11 +5,8 @@ module UnknownAdmin
5
5
  config.unknown_admin = UnknownAdmin
6
6
  require "inherited_resources"
7
7
  require "has_scope"
8
- require "twitter-bootstrap-rails"
9
- require "bootstrap-datepicker-rails"
10
8
  require "bootstrap-will_paginate"
11
9
  require "will_paginate"
12
- require "chosen-rails"
13
10
  require "ransack"
14
11
  require "simple_form"
15
12
  require "strong_parameters"
metadata CHANGED
@@ -1,185 +1,176 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: unknown_admin
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 1
9
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Stefan Kahlert
13
9
  - Dirk Dresch
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
-
18
- date: 2013-02-24 00:00:00 +01:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
13
+ date: 2013-04-29 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: rails
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- requirements:
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
26
20
  - - ~>
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 3
30
- - 2
31
- - 9
21
+ - !ruby/object:Gem::Version
32
22
  version: 3.2.9
33
23
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: inherited_resources
37
24
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- requirements:
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 3.2.9
31
+ - !ruby/object:Gem::Dependency
32
+ name: inherited_resources
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
40
36
  - - ~>
41
- - !ruby/object:Gem::Version
42
- segments:
43
- - 1
44
- - 3
45
- version: "1.3"
37
+ - !ruby/object:Gem::Version
38
+ version: '1.3'
46
39
  type: :runtime
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: has_scope
50
40
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- requirements:
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
53
44
  - - ~>
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 0
57
- - 5
58
- - 0
45
+ - !ruby/object:Gem::Version
46
+ version: '1.3'
47
+ - !ruby/object:Gem::Dependency
48
+ name: has_scope
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
59
54
  version: 0.5.0
60
55
  type: :runtime
61
- version_requirements: *id003
62
- - !ruby/object:Gem::Dependency
63
- name: twitter-bootstrap-rails
64
56
  prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
66
- requirements:
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 0.5.0
63
+ - !ruby/object:Gem::Dependency
64
+ name: bootstrap-sass
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
67
68
  - - ~>
68
- - !ruby/object:Gem::Version
69
- segments:
70
- - 2
71
- - 1
72
- version: "2.1"
69
+ - !ruby/object:Gem::Version
70
+ version: '2.3'
73
71
  type: :runtime
74
- version_requirements: *id004
75
- - !ruby/object:Gem::Dependency
76
- name: bootstrap-datepicker-rails
77
72
  prerelease: false
78
- requirement: &id005 !ruby/object:Gem::Requirement
79
- requirements:
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
80
76
  - - ~>
81
- - !ruby/object:Gem::Version
82
- segments:
83
- - 0
84
- - 6
85
- version: "0.6"
86
- type: :runtime
87
- version_requirements: *id005
88
- - !ruby/object:Gem::Dependency
77
+ - !ruby/object:Gem::Version
78
+ version: '2.3'
79
+ - !ruby/object:Gem::Dependency
89
80
  name: bootstrap-will_paginate
90
- prerelease: false
91
- requirement: &id006 !ruby/object:Gem::Requirement
92
- requirements:
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
93
84
  - - ~>
94
- - !ruby/object:Gem::Version
95
- segments:
96
- - 0
97
- - 0
98
- - 9
85
+ - !ruby/object:Gem::Version
99
86
  version: 0.0.9
100
87
  type: :runtime
101
- version_requirements: *id006
102
- - !ruby/object:Gem::Dependency
103
- name: will_paginate
104
88
  prerelease: false
105
- requirement: &id007 !ruby/object:Gem::Requirement
106
- requirements:
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
107
92
  - - ~>
108
- - !ruby/object:Gem::Version
109
- segments:
110
- - 3
111
- - 0
112
- version: "3.0"
93
+ - !ruby/object:Gem::Version
94
+ version: 0.0.9
95
+ - !ruby/object:Gem::Dependency
96
+ name: will_paginate
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: '3.0'
113
103
  type: :runtime
114
- version_requirements: *id007
115
- - !ruby/object:Gem::Dependency
116
- name: chosen-rails
117
104
  prerelease: false
118
- requirement: &id008 !ruby/object:Gem::Requirement
119
- requirements:
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
120
108
  - - ~>
121
- - !ruby/object:Gem::Version
122
- segments:
123
- - 0
124
- - 9
125
- version: "0.9"
126
- type: :runtime
127
- version_requirements: *id008
128
- - !ruby/object:Gem::Dependency
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
129
112
  name: ransack
130
- prerelease: false
131
- requirement: &id009 !ruby/object:Gem::Requirement
132
- requirements:
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
133
116
  - - ~>
134
- - !ruby/object:Gem::Version
135
- segments:
136
- - 0
137
- - 7
138
- - 0
117
+ - !ruby/object:Gem::Version
139
118
  version: 0.7.0
140
119
  type: :runtime
141
- version_requirements: *id009
142
- - !ruby/object:Gem::Dependency
143
- name: simple_form
144
120
  prerelease: false
145
- requirement: &id010 !ruby/object:Gem::Requirement
146
- requirements:
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ~>
125
+ - !ruby/object:Gem::Version
126
+ version: 0.7.0
127
+ - !ruby/object:Gem::Dependency
128
+ name: simple_form
129
+ requirement: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
147
132
  - - ~>
148
- - !ruby/object:Gem::Version
149
- segments:
150
- - 2
151
- - 0
152
- version: "2.0"
133
+ - !ruby/object:Gem::Version
134
+ version: '2.0'
153
135
  type: :runtime
154
- version_requirements: *id010
155
- - !ruby/object:Gem::Dependency
156
- name: strong_parameters
157
136
  prerelease: false
158
- requirement: &id011 !ruby/object:Gem::Requirement
159
- requirements:
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ~>
141
+ - !ruby/object:Gem::Version
142
+ version: '2.0'
143
+ - !ruby/object:Gem::Dependency
144
+ name: strong_parameters
145
+ requirement: !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
160
148
  - - ~>
161
- - !ruby/object:Gem::Version
162
- segments:
163
- - 0
164
- - 1
165
- version: "0.1"
149
+ - !ruby/object:Gem::Version
150
+ version: '0.1'
166
151
  type: :runtime
167
- version_requirements: *id011
168
- description: Description of UnknownAdmin.
169
- email:
152
+ prerelease: false
153
+ version_requirements: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ~>
157
+ - !ruby/object:Gem::Version
158
+ version: '0.1'
159
+ description: UnknownAdmin makes it easy to create a zero-configuratin admin-tool for
160
+ your models, but still allows a lot of cusomizations to make it fit your needs.
161
+ email:
170
162
  - kahlert@unknown.de
171
163
  - dresch@unknown.de
172
164
  executables: []
173
-
174
165
  extensions: []
175
-
176
166
  extra_rdoc_files: []
177
-
178
- files:
167
+ files:
179
168
  - app/controllers/admin/admin_controller.rb
169
+ - app/controllers/admin/home_controller.rb
180
170
  - app/controllers/admin/resources_controller.rb
181
171
  - app/controllers/admin/users_controller.rb
182
172
  - app/helpers/admin/resources_helper.rb
173
+ - app/helpers/bootstrap_flash_helper.rb
183
174
  - app/models/user.rb
184
175
  - app/views/admin/admin/index.html.erb
185
176
  - app/views/admin/resources/_breadcrumb.html.erb
@@ -227,37 +218,61 @@ files:
227
218
  - MIT-LICENSE
228
219
  - Rakefile
229
220
  - README.md
230
- has_rdoc: true
221
+ - test/dummy/app/assets/javascripts/application.js
222
+ - test/dummy/app/assets/stylesheets/application.css
223
+ - test/dummy/app/controllers/application_controller.rb
224
+ - test/dummy/app/helpers/application_helper.rb
225
+ - test/dummy/app/views/layouts/application.html.erb
226
+ - test/dummy/config/application.rb
227
+ - test/dummy/config/boot.rb
228
+ - test/dummy/config/database.yml
229
+ - test/dummy/config/environment.rb
230
+ - test/dummy/config/environments/development.rb
231
+ - test/dummy/config/environments/production.rb
232
+ - test/dummy/config/environments/test.rb
233
+ - test/dummy/config/initializers/backtrace_silencers.rb
234
+ - test/dummy/config/initializers/inflections.rb
235
+ - test/dummy/config/initializers/mime_types.rb
236
+ - test/dummy/config/initializers/secret_token.rb
237
+ - test/dummy/config/initializers/session_store.rb
238
+ - test/dummy/config/initializers/wrap_parameters.rb
239
+ - test/dummy/config/locales/en.yml
240
+ - test/dummy/config/routes.rb
241
+ - test/dummy/config.ru
242
+ - test/dummy/public/404.html
243
+ - test/dummy/public/422.html
244
+ - test/dummy/public/500.html
245
+ - test/dummy/public/favicon.ico
246
+ - test/dummy/Rakefile
247
+ - test/dummy/README.rdoc
248
+ - test/dummy/script/rails
249
+ - test/test_helper.rb
250
+ - test/unknown_admin_test.rb
231
251
  homepage: http://www.unknown.de
232
252
  licenses: []
233
-
234
253
  post_install_message:
235
254
  rdoc_options: []
236
-
237
- require_paths:
255
+ require_paths:
238
256
  - lib
239
- required_ruby_version: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - ">="
242
- - !ruby/object:Gem::Version
243
- segments:
244
- - 0
245
- version: "0"
246
- required_rubygems_version: !ruby/object:Gem::Requirement
247
- requirements:
248
- - - ">="
249
- - !ruby/object:Gem::Version
250
- segments:
251
- - 0
252
- version: "0"
257
+ required_ruby_version: !ruby/object:Gem::Requirement
258
+ none: false
259
+ requirements:
260
+ - - ! '>='
261
+ - !ruby/object:Gem::Version
262
+ version: '0'
263
+ required_rubygems_version: !ruby/object:Gem::Requirement
264
+ none: false
265
+ requirements:
266
+ - - ! '>='
267
+ - !ruby/object:Gem::Version
268
+ version: '0'
253
269
  requirements: []
254
-
255
270
  rubyforge_project:
256
- rubygems_version: 1.3.6
271
+ rubygems_version: 1.8.24
257
272
  signing_key:
258
273
  specification_version: 3
259
- summary: Summary of UnknownAdmin.
260
- test_files:
274
+ summary: UnknownAdmin is yet another Admin-Tools for Rails
275
+ test_files:
261
276
  - test/dummy/app/assets/javascripts/application.js
262
277
  - test/dummy/app/assets/stylesheets/application.css
263
278
  - test/dummy/app/controllers/application_controller.rb