tkh_admin_panel 0.9 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +11 -7
- data/app/assets/images/{admin-logo.png → admin/tkh-logo.png} +0 -0
- data/app/assets/javascripts/{custom.js.coffee → admin/custom.js.coffee} +0 -0
- data/app/assets/javascripts/admin/pages.js.coffee +7 -0
- data/app/assets/javascripts/admin.js +2 -1
- data/app/assets/stylesheets/admin/bootstrap_and_overrides.css.scss +1 -0
- data/app/assets/stylesheets/admin/custom.css.scss +146 -0
- data/app/assets/stylesheets/admin/united.css.scss +7576 -0
- data/app/assets/stylesheets/admin.css.scss +4 -3
- data/app/controllers/settings_controller.rb +16 -5
- data/app/models/setting.rb +2 -9
- data/app/views/layouts/admin.html.erb +65 -54
- data/config/routes.rb +2 -2
- data/lib/tkh_admin_panel/version.rb +1 -1
- data/lib/tkh_admin_panel.rb +8 -4
- data/tkh_admin_panel.gemspec +9 -5
- metadata +75 -18
- data/app/assets/stylesheets/bootstrap_and_overrides.css.scss +0 -2
- data/app/assets/stylesheets/custom.css.scss +0 -27
- data/app/assets/stylesheets/united.css.scss +0 -5262
@@ -1,3 +1,4 @@
|
|
1
|
-
@import 'bootstrap_and_overrides.css.scss';
|
2
|
-
@import 'united.css.scss';
|
3
|
-
@import 'custom.css.scss';
|
1
|
+
@import 'admin/bootstrap_and_overrides.css.scss';
|
2
|
+
@import 'admin/united.css.scss';
|
3
|
+
@import 'admin/custom.css.scss';
|
4
|
+
|
@@ -1,24 +1,35 @@
|
|
1
1
|
class SettingsController < ApplicationController
|
2
|
-
|
2
|
+
|
3
3
|
before_filter :authenticate
|
4
4
|
before_filter :authenticate_with_admin
|
5
|
-
|
5
|
+
|
6
|
+
def index
|
7
|
+
redirect_to setting_path(Setting.first)
|
8
|
+
end
|
9
|
+
|
6
10
|
def show
|
7
11
|
@setting = Setting.first
|
8
12
|
switch_to_admin_layout
|
9
13
|
end
|
10
|
-
|
14
|
+
|
11
15
|
def edit
|
12
16
|
@setting = Setting.first
|
13
17
|
switch_to_admin_layout
|
14
18
|
end
|
15
|
-
|
19
|
+
|
16
20
|
def update
|
17
21
|
@setting = Setting.first
|
18
|
-
if @setting.update_attributes(
|
22
|
+
if @setting.update_attributes(setting_params)
|
19
23
|
redirect_to @setting, notice: t('settings.update.notice')
|
20
24
|
else
|
21
25
|
render action: "edit", warning: t('settings.update.warning')
|
22
26
|
end
|
23
27
|
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
32
|
+
def setting_params
|
33
|
+
params.require(:setting).permit( :company_name, :contact_email, :site_name, :site_tagline, :blog_name, :blog_tagline, :disable_blog, :enable_comments_in_pages, :enable_comments_in_blog )
|
34
|
+
end
|
24
35
|
end
|
data/app/models/setting.rb
CHANGED
@@ -1,12 +1,5 @@
|
|
1
|
-
# this is needed for now to make mass assignment security compatible with the translation of globalize3
|
2
|
-
Globalize::ActiveRecord::Translation.class_eval do
|
3
|
-
attr_accessible :locale
|
4
|
-
end
|
5
|
-
|
6
1
|
class Setting < ActiveRecord::Base
|
7
|
-
|
8
|
-
attr_accessible :company_name, :contact_email, :site_name, :site_tagline, :blog_name, :blog_tagline, :disable_blog, :enable_comments_in_pages, :enable_comments_in_blog
|
9
|
-
|
2
|
+
|
10
3
|
translates :site_name, :site_tagline, :blog_name, :blog_tagline
|
11
|
-
|
4
|
+
|
12
5
|
end
|
@@ -2,73 +2,84 @@
|
|
2
2
|
<html lang="<%= I18n.locale.to_s %>">
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
5
|
<title><%= t("admin_panel_for") + ' ' + Setting.first.try(:site_name) %></title>
|
7
|
-
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
+
<%= stylesheet_link_tag "admin", :media => "all" %>
|
8
|
+
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
9
|
+
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
8
10
|
<!--[if lt IE 9]>
|
9
|
-
<script src="
|
11
|
+
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
12
|
+
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
|
10
13
|
<![endif]-->
|
11
|
-
|
12
|
-
<%=
|
13
|
-
<!-- Le fav and touch icons -->
|
14
|
-
<%= favicon_link_tag %>
|
15
|
-
<link href="images/apple-touch-icon.png" rel="apple-touch-icon">
|
16
|
-
<link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72">
|
17
|
-
<link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114">
|
18
|
-
<%= csrf_meta_tag %>
|
14
|
+
<%= favicon_link_tag %>
|
15
|
+
<%= csrf_meta_tag %>
|
19
16
|
<% # This line ensures javascript code can access the current locale from Rails %>
|
20
17
|
<script type="text/javascript">var tkh_locale = '<%= I18n.locale.to_s %>';</script>
|
21
18
|
</head>
|
22
19
|
|
23
20
|
<body>
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
21
|
+
|
22
|
+
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
23
|
+
<ul class="nav navbar-nav">
|
24
|
+
<%= content_tag :li, link_to(Setting.first.try(:site_name), root_path) %>
|
25
|
+
<%= content_tag :li, link_to( 'blog', blog_path) %>
|
26
|
+
</ul>
|
27
|
+
<ul class="nav navbar-nav navbar-right navbar-login-info">
|
28
|
+
<li class="dropdown">
|
29
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= current_user.email %> <b class="caret"></b></a>
|
30
|
+
<ul class="dropdown-menu">
|
31
|
+
<li><%= link_to 'log out', logout_path %></li>
|
32
|
+
</ul>
|
33
|
+
</li>
|
34
|
+
</ul>
|
35
35
|
</div>
|
36
|
-
|
37
|
-
<div class="container
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
36
|
+
|
37
|
+
<div class="container">
|
38
|
+
|
39
|
+
<div class="row">
|
40
|
+
<div class="col-xs-12">
|
41
|
+
<h1><%= t 'admin_panel' %><br />
|
42
|
+
<%= link_to image_tag('admin/admin-logo.jpg'), root_path %><br /><br />
|
43
|
+
</h1>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="row">
|
48
|
+
<div class="col-xs-12 col-sm-9 col-lg-10">
|
49
|
+
<% flash.each do |name, msg| %>
|
50
|
+
<div class="alert alert-<%= name == :notice ? "success" : "danger" %>">
|
51
|
+
<a class="close" data-dismiss="alert">×</a>
|
52
|
+
<%= msg %>
|
53
|
+
</div>
|
54
|
+
<% end %>
|
50
55
|
<%= yield %>
|
51
56
|
</div>
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
+
|
58
|
+
<div class="col-xs-12 col-sm-3 col-lg-2">
|
59
|
+
<%= render 'shared/language_switcher' %>
|
60
|
+
<%= yield :admin_sidebar %>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<div class="row">
|
65
|
+
<footer class="col-xs-12">
|
66
|
+
<hr>
|
67
|
+
<p><b>Ten Thousand Hours</b><br />
|
68
|
+
<%= link_to "http://tenthousandhours.eu", "http://tenthousandhours.eu" %><br />
|
69
|
+
<%= link_to "Contact TKH", "http://tenthousandhours.eu/pages/5-contact-form" %><br /><br />
|
70
|
+
<%= image_tag 'admin/tkh-logo.png', alt: 'Ten Thousand Hours logo' %><br />
|
71
|
+
</p>
|
72
|
+
</footer>
|
73
|
+
</div>
|
74
|
+
|
57
75
|
</div> <!-- /container -->
|
58
|
-
|
59
|
-
<div class="row-fluid">
|
60
|
-
<footer class="span12">
|
61
|
-
<hr>
|
62
|
-
<p><b>Ten Thousand Hours</b><br />
|
63
|
-
<%= link_to "http://tenthousandhours.eu", "http://tenthousandhours.eu" %><br />
|
64
|
-
<%= link_to "Contact TKH", "http://tenthousandhours.eu/pages/5-contact-form" %><br /></p>
|
65
|
-
</footer>
|
66
|
-
</div>
|
67
|
-
|
68
|
-
<!-- Le javascript
|
69
|
-
================================================== -->
|
70
|
-
<!-- Placed at the end of the document so the pages load faster -->
|
76
|
+
|
71
77
|
<%= javascript_include_tag "admin" %>
|
72
78
|
|
79
|
+
<% # the twitter typeahead javascript library needs all typeahead form fields to be present in DOM. this is an ugly hack %>
|
80
|
+
<% if controller.controller_name == 'pages' %>
|
81
|
+
<%= javascript_include_tag 'admin/pages' %>
|
82
|
+
<% end %>
|
83
|
+
|
73
84
|
</body>
|
74
85
|
</html>
|
data/config/routes.rb
CHANGED
data/lib/tkh_admin_panel.rb
CHANGED
@@ -1,18 +1,22 @@
|
|
1
|
-
require
|
1
|
+
require 'tkh_admin_panel/version'
|
2
|
+
require 'globalize'
|
2
3
|
require 'bootstrap-sass'
|
4
|
+
require 'twitter-typeahead-rails'
|
5
|
+
require 'bootstrap-will_paginate'
|
3
6
|
require 'simple_form'
|
4
7
|
require 'tkh_admin_panel/tkh_admin_panel_action_controller_extension'
|
5
8
|
require 'tkh_authentication'
|
9
|
+
require 'jquery-ui-rails'
|
6
10
|
|
7
11
|
module TkhAdminPanel
|
8
12
|
class Engine < ::Rails::Engine
|
9
13
|
initializer "TkhAdminPanel precompile hook", :group => :all do |app|
|
10
|
-
app.config.assets.precompile += ['admin.js', 'admin.css']
|
14
|
+
app.config.assets.precompile += ['admin.js', 'admin.css', 'admin/pages.js']
|
11
15
|
end
|
12
|
-
|
16
|
+
|
13
17
|
# to extend the application_controller in the host app
|
14
18
|
initializer 'tkh_admin_panel.controller' do |app|
|
15
|
-
ActiveSupport.on_load(:action_controller) do
|
19
|
+
ActiveSupport.on_load(:action_controller) do
|
16
20
|
include TkhAdminPanelActionControllerExtension
|
17
21
|
end
|
18
22
|
end
|
data/tkh_admin_panel.gemspec
CHANGED
@@ -8,15 +8,19 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.summary = %q{A Rails admin panel engine with layout, assets, and basic functionality}
|
9
9
|
gem.homepage = "https://github.com/allesklar/tkh_admin_panel"
|
10
10
|
|
11
|
-
gem.add_dependency "railties", "~> 4.0"
|
12
|
-
gem.add_dependency "bootstrap-sass", '~> 2.3.2'
|
13
|
-
gem.add_dependency "simple_form", '3.0.0.rc'
|
14
|
-
gem.add_dependency "tkh_authentication", '~> 0.9'
|
15
|
-
|
16
11
|
gem.files = `git ls-files`.split($\)
|
17
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
14
|
gem.name = "tkh_admin_panel"
|
20
15
|
gem.require_paths = ["lib"]
|
21
16
|
gem.version = TkhAdminPanel::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency "railties", "> 4.0"
|
19
|
+
gem.add_dependency "globalize"
|
20
|
+
gem.add_dependency "bootstrap-sass"
|
21
|
+
gem.add_dependency "bootstrap-will_paginate"
|
22
|
+
gem.add_dependency 'twitter-typeahead-rails' # for autocomplete fields in forms
|
23
|
+
gem.add_dependency "simple_form", '~> 3.0.1'
|
24
|
+
gem.add_dependency "tkh_authentication", '~> 0.9'
|
25
|
+
gem.add_dependency "jquery-ui-rails"
|
22
26
|
end
|
metadata
CHANGED
@@ -1,57 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tkh_admin_panel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swami Atma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>'
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>'
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: globalize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bootstrap-sass
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - '>='
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: '0'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bootstrap-will_paginate
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: twitter-typeahead-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
41
83
|
- !ruby/object:Gem::Dependency
|
42
84
|
name: simple_form
|
43
85
|
requirement: !ruby/object:Gem::Requirement
|
44
86
|
requirements:
|
45
|
-
- -
|
87
|
+
- - ~>
|
46
88
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.0.
|
89
|
+
version: 3.0.1
|
48
90
|
type: :runtime
|
49
91
|
prerelease: false
|
50
92
|
version_requirements: !ruby/object:Gem::Requirement
|
51
93
|
requirements:
|
52
|
-
- -
|
94
|
+
- - ~>
|
53
95
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.0.
|
96
|
+
version: 3.0.1
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: tkh_authentication
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +108,20 @@ dependencies:
|
|
66
108
|
- - ~>
|
67
109
|
- !ruby/object:Gem::Version
|
68
110
|
version: '0.9'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: jquery-ui-rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
69
125
|
description: Admin panel layout engine
|
70
126
|
email:
|
71
127
|
- swami@TenThousandHours.eu
|
@@ -80,13 +136,14 @@ files:
|
|
80
136
|
- LICENSE
|
81
137
|
- README.md
|
82
138
|
- Rakefile
|
83
|
-
- app/assets/images/admin-logo.png
|
139
|
+
- app/assets/images/admin/tkh-logo.png
|
84
140
|
- app/assets/javascripts/admin.js
|
85
|
-
- app/assets/javascripts/custom.js.coffee
|
141
|
+
- app/assets/javascripts/admin/custom.js.coffee
|
142
|
+
- app/assets/javascripts/admin/pages.js.coffee
|
86
143
|
- app/assets/stylesheets/admin.css.scss
|
87
|
-
- app/assets/stylesheets/bootstrap_and_overrides.css.scss
|
88
|
-
- app/assets/stylesheets/custom.css.scss
|
89
|
-
- app/assets/stylesheets/united.css.scss
|
144
|
+
- app/assets/stylesheets/admin/bootstrap_and_overrides.css.scss
|
145
|
+
- app/assets/stylesheets/admin/custom.css.scss
|
146
|
+
- app/assets/stylesheets/admin/united.css.scss
|
90
147
|
- app/controllers/settings_controller.rb
|
91
148
|
- app/mailers/admin_mailer.rb
|
92
149
|
- app/models/setting.rb
|
@@ -133,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
190
|
version: '0'
|
134
191
|
requirements: []
|
135
192
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
193
|
+
rubygems_version: 2.1.10
|
137
194
|
signing_key:
|
138
195
|
specification_version: 4
|
139
196
|
summary: A Rails admin panel engine with layout, assets, and basic functionality
|
@@ -1,27 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
margin-top: 35px;
|
3
|
-
@include hyphens;
|
4
|
-
}
|
5
|
-
|
6
|
-
footer {
|
7
|
-
margin: 2em 1em .5em;
|
8
|
-
text-align: center;
|
9
|
-
}
|
10
|
-
|
11
|
-
input, textarea {
|
12
|
-
width: 450px;
|
13
|
-
}
|
14
|
-
|
15
|
-
h1 {
|
16
|
-
text-align: center;
|
17
|
-
}
|
18
|
-
|
19
|
-
form {
|
20
|
-
margin: 2em .5em;
|
21
|
-
}
|
22
|
-
|
23
|
-
.help-block { color: #999; }
|
24
|
-
|
25
|
-
.form-horizontal input + .help-block, .form-horizontal select + .help-block, .form-horizontal textarea + .help-block, .form-horizontal .uneditable-input + .help-block, .form-horizontal .input-prepend + .help-block, .form-horizontal .input-append + .help-block {
|
26
|
-
margin-top: 3px;
|
27
|
-
}
|