spud_core 0.8.13 → 0.8.15
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +62 -0
- data/Rakefile +2 -14
- data/app/assets/javascripts/spud/admin/application.js +47 -18
- data/app/controllers/spud/admin/application_controller.rb +0 -2
- data/app/controllers/spud/application_controller.rb +19 -6
- data/app/controllers/spud/password_resets_controller.rb +37 -37
- data/app/controllers/spud/setup_controller.rb +2 -6
- data/app/helpers/spud/admin/application_helper.rb +22 -23
- data/app/views/layouts/spud/admin/detail.html.erb +3 -3
- data/app/views/spud/admin/dashboard/index.html.erb +1 -1
- data/lib/spud_core/configuration.rb +1 -0
- data/lib/spud_core/engine.rb +2 -2
- data/lib/spud_core/version.rb +1 -1
- data/spec/controllers/spud/admin/application_controller_spec.rb +49 -0
- data/spec/controllers/spud/admin/dashbord_controller_spec.rb +60 -0
- data/spec/controllers/spud/admin/users_controller_spec.rb +194 -0
- data/spec/controllers/spud/application_controller_spec.rb +49 -0
- data/spec/controllers/spud/password_reset_controller_spec.rb +93 -0
- data/spec/controllers/spud/setup_controller_spec.rb +56 -0
- data/spec/controllers/spud/sitemap_controllers_spec.rb +20 -0
- data/spec/controllers/spud/user_sessions_controller_spec.rb +53 -0
- data/spec/controllers/spud/users_controller_spec.rb +69 -0
- data/{test → spec}/dummy/README.rdoc +0 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
- data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
- data/{test → spec}/dummy/config.ru +0 -0
- data/{test → spec}/dummy/config/application.rb +2 -0
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/{test → spec}/dummy/config/database.yml +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +0 -0
- data/{test → spec}/dummy/config/environments/production.rb +0 -0
- data/{test → spec}/dummy/config/environments/test.rb +0 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/{test → spec}/dummy/config/initializers/secret_token.rb +0 -0
- data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{test → spec}/dummy/config/locales/en.yml +0 -0
- data/{test → spec}/dummy/config/routes.rb +0 -0
- data/{test → spec}/dummy/db/schema.rb +11 -1
- data/spec/dummy/log/development.log +39 -0
- data/spec/dummy/log/test.log +54295 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/{test → spec}/dummy/public/favicon.ico +0 -0
- data/{test → spec}/dummy/script/rails +0 -0
- data/spec/helpers/spud/admin/application_helper_spec.rb +150 -0
- data/spec/models/spud_user_spec.rb +27 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/support/authlogic_helper.rb +2 -0
- metadata +220 -114
- data/README.rdoc +0 -3
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -46
- data/test/dummy/log/test.log +0 -17677
- data/test/fixtures/spud_user_settings.yml +0 -11
- data/test/functional/spud/password_resets_controller_test.rb +0 -7
- data/test/unit/helpers/spud/password_resets_helper_test.rb +0 -4
- data/test/unit/spud_user_settings_test.rb +0 -7
data/README.markdown
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
[![Build Status](https://secure.travis-ci.org/davydotcom/spud_core_admin.png)](http://travis-ci.org/davydotcom/spud_core_admin)
|
2
|
+
|
3
|
+
Spud Core Admin
|
4
|
+
===============
|
5
|
+
|
6
|
+
Spud Admin is a dependency package that adds a nice looking administrative panel to any project you add it to with built in authlogic authentication ready to go out of the box. It supports easy engine integration and there are several planned future engines that we plan on designing for the spud suite. The first of which is Spud CMS which can be found at http://github.com/davydotcom/spud_cms
|
7
|
+
|
8
|
+
Installation/Usage
|
9
|
+
------------------
|
10
|
+
|
11
|
+
1. In your Gemfile add the following
|
12
|
+
|
13
|
+
gem 'spud_core'
|
14
|
+
|
15
|
+
2. Run bundle install
|
16
|
+
3. Copy in database migrations to your new rails project
|
17
|
+
|
18
|
+
bundle exec rake spud_core:install:migrations
|
19
|
+
rake db:migrate
|
20
|
+
|
21
|
+
4. run a rails server instance and point your browser to /spud/admin
|
22
|
+
|
23
|
+
|
24
|
+
Adding Your Own Engines
|
25
|
+
-----------------------
|
26
|
+
|
27
|
+
Creating a rails engine that ties into spud admin is fairly straight forward
|
28
|
+
In your new engine add spud_admin as a dependency and create an initializer inside your engine class as such:
|
29
|
+
|
30
|
+
initializer :admin do
|
31
|
+
Spud::Core.configure do |config|
|
32
|
+
config.admin_applications += [{:name => "Pages",:thumbnail => "spud/admin/pages_thumb.png",:url => "/spud/admin/pages",:order => 0}]
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
You can use the layouts provided with spud admin by using 'spud/admin/application' or 'spud/admin/detail' layouts
|
38
|
+
|
39
|
+
When creating controllers for the admin panel create them in the Spud::Admin Namespace and have them extend Spud::Admin::ApplicationController for automatic user authentication restrictions.
|
40
|
+
|
41
|
+
Testing
|
42
|
+
-----------------
|
43
|
+
|
44
|
+
Spud uses RSpec for testing. Get the tests running with a few short commands:
|
45
|
+
|
46
|
+
1. Create and migrate the databases:
|
47
|
+
|
48
|
+
rake db:create
|
49
|
+
rake db:migrate
|
50
|
+
|
51
|
+
2. Load the schema in to the test database:
|
52
|
+
|
53
|
+
rake app:db:test:prepare
|
54
|
+
|
55
|
+
3. Run the tests with RSpec
|
56
|
+
|
57
|
+
rspec spec
|
58
|
+
|
59
|
+
After the tests have completed the current code coverage stats is available by opening ```/coverage/index.html``` in a browser.
|
60
|
+
|
61
|
+
|
62
|
+
|
data/Rakefile
CHANGED
@@ -20,21 +20,9 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
20
20
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
21
|
end
|
22
22
|
|
23
|
-
APP_RAKEFILE = File.expand_path("../
|
23
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
24
24
|
load 'rails/tasks/engine.rake'
|
25
25
|
|
26
|
-
|
27
|
-
|
28
26
|
Bundler::GemHelper.install_tasks
|
29
27
|
|
30
|
-
require 'rake
|
31
|
-
|
32
|
-
# Rake::TestTask.new(:test) do |t|
|
33
|
-
# t.libs << 'lib'
|
34
|
-
# t.libs << 'test'
|
35
|
-
# t.pattern = 'test/**/*_test.rb'
|
36
|
-
# t.verbose = false
|
37
|
-
# end
|
38
|
-
|
39
|
-
|
40
|
-
task :default => [:spec]
|
28
|
+
require 'rake'
|
@@ -11,10 +11,10 @@ Spud = (typeof(Spud) == 'undefined') ? {} : Spud;
|
|
11
11
|
Spud.Admin = (typeof(Spud.Admin) == 'undefined') ? {} : Spud.Admin;
|
12
12
|
|
13
13
|
$(document).ready(function() {
|
14
|
+
console.log("HELLO!");
|
14
15
|
$('#user_table').dataTable({
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
"bJQueryUI": true,
|
17
|
+
"sPaginationType": "full_numbers"
|
18
18
|
});
|
19
19
|
|
20
20
|
$('a.ajax').live('click', function() {
|
@@ -35,7 +35,7 @@ $(document).ready(function() {
|
|
35
35
|
$('a.close_dialog').live('click', function() {
|
36
36
|
$('#dialog').dialog('close');
|
37
37
|
})
|
38
|
-
|
38
|
+
|
39
39
|
$('a[data-method="delete"]').live('ajax:success',
|
40
40
|
function(data, textStatus, jqXHR){
|
41
41
|
$(this).closest('tr').fadeOut();
|
@@ -44,18 +44,17 @@ $(document).ready(function() {
|
|
44
44
|
$('form[data-remote="true"]').live('ajax:success',
|
45
45
|
function(data, textStatus, jqXHR){
|
46
46
|
$(this).closest('#dialog').dialog('close');
|
47
|
-
console.log(data)
|
48
47
|
});
|
49
48
|
$('a.button').button();
|
50
49
|
|
51
50
|
|
52
|
-
$('input[type=submit].btn').click(function() {$(this).button('loading')});
|
51
|
+
$('input[type=submit].btn').click(function() {$(this).button('loading');});
|
53
52
|
|
54
53
|
$('#multisite_switcher select').change(function() {
|
55
54
|
$(this).parent().submit();
|
56
55
|
// alert('test');
|
57
56
|
});
|
58
|
-
|
57
|
+
initFormTabs();
|
59
58
|
highdpi_init();
|
60
59
|
} );
|
61
60
|
|
@@ -75,14 +74,14 @@ function initFormTabs(){
|
|
75
74
|
var tabNames = [];
|
76
75
|
$('.formtabs .formtab').each(function(tabind) {
|
77
76
|
this.id = 'tab-' + tabind;
|
78
|
-
tabNames.push($('.tab_name',this).first().val())
|
77
|
+
tabNames.push($('.tab_name',this).first().val());
|
79
78
|
});
|
80
79
|
var tabButtons = $('.formtabs .formtab_buttons').first();
|
81
80
|
for(var x=0;x<tabNames.length;x++)
|
82
81
|
{
|
83
|
-
tabButtons.append($('<li><a href="#tab-' + x + '">' + tabNames[x] + '</a></li>'))
|
82
|
+
tabButtons.append($('<li><a href="#tab-' + x + '">' + tabNames[x] + '</a></li>'));
|
84
83
|
}
|
85
|
-
|
84
|
+
|
86
85
|
$('.formtabs').tabs();
|
87
86
|
}
|
88
87
|
|
@@ -102,7 +101,7 @@ function initTinyMCE(selector) {
|
|
102
101
|
convert_urls : false,
|
103
102
|
height:"400"
|
104
103
|
});
|
105
|
-
|
104
|
+
|
106
105
|
|
107
106
|
}
|
108
107
|
|
@@ -110,16 +109,46 @@ function initDatePicker(selector){
|
|
110
109
|
selector = (typeof(selector) == 'undefined') ? '.spud_form_date_picker' : selector;
|
111
110
|
$(selector).datepicker({
|
112
111
|
dateFormat: 'yy-mm-dd'
|
113
|
-
});
|
112
|
+
});
|
114
113
|
}
|
115
114
|
|
116
115
|
function highdpi_init() {
|
117
|
-
if(
|
118
|
-
|
116
|
+
if(window.devicePixelRatio > 1)
|
117
|
+
{
|
118
|
+
|
119
|
+
var els = jQuery("img").get();
|
119
120
|
for(var i = 0; i < els.length; i++) {
|
120
|
-
var
|
121
|
-
src = src
|
122
|
-
|
121
|
+
var hiDpiSrc = $(els[i]).attr('hidpi_src');
|
122
|
+
var src = els[i].src;
|
123
|
+
|
124
|
+
if(hiDpiSrc)
|
125
|
+
{
|
126
|
+
src = hiDpiSrc;
|
127
|
+
}
|
128
|
+
else
|
129
|
+
{
|
130
|
+
var path_segments = src.split('.');
|
131
|
+
var path_without_extension = path_segments.slice(0, (path_segments.length - 1)).join(".");
|
132
|
+
var extension = path_segments[path_segments.length - 1];
|
133
|
+
src = path_without_extension + "@2x." + extension;
|
134
|
+
}
|
135
|
+
|
136
|
+
if(hiDpiSrc) {
|
137
|
+
$.ajax({
|
138
|
+
type: 'HEAD',
|
139
|
+
async: true,
|
140
|
+
element: els[i],
|
141
|
+
url: hiDpiSrc,
|
142
|
+
success: function(message) {
|
143
|
+
this.element.src = this.url;
|
144
|
+
}
|
145
|
+
});
|
146
|
+
}
|
147
|
+
|
148
|
+
|
149
|
+
|
123
150
|
}
|
124
151
|
}
|
125
|
-
|
152
|
+
|
153
|
+
|
154
|
+
}
|
@@ -8,9 +8,7 @@ class Spud::Admin::ApplicationController < Spud::ApplicationController
|
|
8
8
|
|
9
9
|
private
|
10
10
|
def require_admin_user
|
11
|
-
puts "Checking for Admin"
|
12
11
|
return false if !require_user
|
13
|
-
puts "user found, verifying permissions"
|
14
12
|
if !@current_user.super_admin && current_user_permissions.count == 0
|
15
13
|
flash[:error] = "User must be an administrator to view this area."
|
16
14
|
redirect_to root_url() and return false
|
@@ -1,16 +1,27 @@
|
|
1
1
|
class Spud::ApplicationController < ActionController::Base
|
2
2
|
unloadable
|
3
3
|
protect_from_forgery
|
4
|
-
helper_method :current_user_session, :current_user
|
4
|
+
helper_method :current_user_session, :current_user, :current_site_name
|
5
5
|
around_filter :set_time_zone
|
6
6
|
around_filter :multisite_caching
|
7
7
|
before_filter :to
|
8
|
-
|
8
|
+
|
9
|
+
|
10
|
+
def current_site_name
|
11
|
+
# puts "request.host_with_port = #{request.host_with_port}"
|
12
|
+
return Spud::Core.site_name if !Spud::Core.multisite_mode_enabled
|
13
|
+
config = Spud::Core.site_config_for_host(request.host_with_port)
|
14
|
+
return Spud::Core.site_name if config.blank?
|
15
|
+
|
16
|
+
return config[:site_name]
|
17
|
+
end
|
9
18
|
|
10
19
|
private
|
20
|
+
|
11
21
|
def to
|
12
22
|
ActionMailer::Base.default_url_options = {:host => request.host_with_port}
|
13
23
|
end
|
24
|
+
|
14
25
|
def current_user_session
|
15
26
|
return @current_user_session if defined?(@current_user_session)
|
16
27
|
@current_user_session = SpudUserSession.find
|
@@ -20,10 +31,12 @@ class Spud::ApplicationController < ActionController::Base
|
|
20
31
|
return @current_user if defined?(@current_user)
|
21
32
|
@current_user = current_user_session && current_user_session.spud_user
|
22
33
|
end
|
34
|
+
|
23
35
|
def current_user_permissions
|
24
36
|
return @current_user_permissions if defined?(@current_user_permissions)
|
25
37
|
@current_user_permissions = current_user.spud_admin_permissions.where(:access => true).all
|
26
38
|
end
|
39
|
+
|
27
40
|
def require_user
|
28
41
|
unless current_user
|
29
42
|
store_location
|
@@ -42,11 +55,11 @@ class Spud::ApplicationController < ActionController::Base
|
|
42
55
|
return false
|
43
56
|
end
|
44
57
|
end
|
45
|
-
|
58
|
+
|
46
59
|
def store_location
|
47
60
|
session[:return_to] = request.url
|
48
61
|
end
|
49
|
-
|
62
|
+
|
50
63
|
def redirect_back_or_default(default)
|
51
64
|
redirect_to(session[:return_to] || default)
|
52
65
|
session[:return_to] = nil
|
@@ -73,11 +86,11 @@ class Spud::ApplicationController < ActionController::Base
|
|
73
86
|
Rails.application.config.action_controller.page_cache_directory = File.join(old_cache_directory.to_s,"main")
|
74
87
|
end
|
75
88
|
end
|
76
|
-
|
89
|
+
|
77
90
|
yield
|
78
91
|
|
79
92
|
ensure
|
80
93
|
Rails.application.config.action_controller.page_cache_directory = old_cache_directory
|
81
94
|
|
82
95
|
end
|
83
|
-
end
|
96
|
+
end
|
@@ -1,50 +1,50 @@
|
|
1
1
|
class Spud::PasswordResetsController < Spud::ApplicationController
|
2
2
|
before_filter :require_no_user, :only => [:new, :create]
|
3
|
-
before_filter :load_user_using_perishable_token, :only => [:edit, :update]
|
3
|
+
before_filter :load_user_using_perishable_token, :only => [:edit, :update]
|
4
4
|
|
5
5
|
layout 'spud/login/application'
|
6
6
|
|
7
|
-
def new
|
8
|
-
render
|
9
|
-
end
|
10
|
-
|
11
|
-
def create
|
12
|
-
@user = SpudUser.find_by_email(params[:email])
|
13
|
-
if @user
|
7
|
+
def new
|
8
|
+
render
|
9
|
+
end
|
10
|
+
|
11
|
+
def create
|
12
|
+
@user = SpudUser.find_by_email(params[:email])
|
13
|
+
if @user
|
14
14
|
Spud::CoreMailer.forgot_password_notification(@user).deliver
|
15
|
-
flash[:notice] = "Instructions to reset your password have been emailed to you. " +
|
16
|
-
"Please check your email."
|
15
|
+
flash[:notice] = "Instructions to reset your password have been emailed to you. " +
|
16
|
+
"Please check your email."
|
17
17
|
redirect_to new_spud_user_session_url
|
18
|
-
else
|
19
|
-
flash[:notice] = "No user was found with that email address"
|
20
|
-
render :action => :new
|
21
|
-
end
|
22
|
-
end
|
18
|
+
else
|
19
|
+
flash[:notice] = "No user was found with that email address"
|
20
|
+
render :action => :new
|
21
|
+
end
|
22
|
+
end
|
23
23
|
|
24
|
-
def edit
|
25
|
-
render
|
26
|
-
end
|
27
|
-
|
28
|
-
def update
|
29
|
-
@user.password = params[:spud_user][:password]
|
30
|
-
@user.password_confirmation = params[:spud_user][:password_confirmation]
|
31
|
-
if @user.save
|
32
|
-
flash[:notice] = "Password successfully updated"
|
24
|
+
def edit
|
25
|
+
render
|
26
|
+
end
|
27
|
+
|
28
|
+
def update
|
29
|
+
@user.password = params[:spud_user][:password]
|
30
|
+
@user.password_confirmation = params[:spud_user][:password_confirmation]
|
31
|
+
if @user.save
|
32
|
+
flash[:notice] = "Password successfully updated"
|
33
33
|
redirect_to new_spud_user_session_url
|
34
|
-
else
|
34
|
+
else
|
35
35
|
render :action => :edit
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
def load_user_using_perishable_token
|
41
|
-
@user = SpudUser.find_using_perishable_token(params[:id])
|
42
|
-
unless @user
|
43
|
-
flash[:notice] = "We're sorry, but we could not locate your account. " +
|
44
|
-
"If you are having issues try copying and pasting the URL " +
|
45
|
-
"from your email into your browser or restarting the " +
|
46
|
-
"reset password process."
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
def load_user_using_perishable_token
|
41
|
+
@user = SpudUser.find_using_perishable_token(params[:id])
|
42
|
+
unless @user
|
43
|
+
flash[:notice] = "We're sorry, but we could not locate your account. " +
|
44
|
+
"If you are having issues try copying and pasting the URL " +
|
45
|
+
"from your email into your browser or restarting the " +
|
46
|
+
"reset password process."
|
47
47
|
redirect_to new_spud_user_session_url
|
48
|
-
end
|
48
|
+
end
|
49
49
|
end
|
50
50
|
end
|
@@ -1,13 +1,10 @@
|
|
1
1
|
class Spud::SetupController < Spud::ApplicationController
|
2
2
|
layout 'spud/setup'
|
3
3
|
def index
|
4
|
-
logger.debug("---Spud setup form running!")
|
5
4
|
@page_thumbnail = "spud/admin/users_thumb.png"
|
6
5
|
@page_name = "First Time Setup"
|
7
|
-
if SpudUser.
|
8
|
-
flash[:error] = "Access Denied! This wizard may only be executed when the database is empty."
|
9
|
-
logger.debug "We have a user count: " + SpudUser.all.count.to_s
|
10
|
-
|
6
|
+
if SpudUser.count != 0
|
7
|
+
flash[:error] = "Access Denied! This wizard may only be executed when the database is empty."
|
11
8
|
redirect_to new_spud_user_session_url and return
|
12
9
|
end
|
13
10
|
|
@@ -15,7 +12,6 @@ class Spud::SetupController < Spud::ApplicationController
|
|
15
12
|
@user = SpudUser.new(:login => params[:login],:email => params[:email],:password => params[:password],:password_confirmation => params[:password_confirmation])
|
16
13
|
@user.super_admin = true
|
17
14
|
if @user.save
|
18
|
-
logger.debug "REDIRECTING!"
|
19
15
|
session[:return_to] = spud_admin_root_url
|
20
16
|
redirect_to new_spud_user_session_url and return
|
21
17
|
end
|
@@ -1,40 +1,39 @@
|
|
1
1
|
module Spud::Admin::ApplicationHelper
|
2
|
+
|
3
|
+
def hidpi_asset(path)
|
4
|
+
begin
|
5
|
+
return asset_path(path.gsub(/\.png/,"@2x.png"))
|
6
|
+
rescue
|
7
|
+
return nil
|
8
|
+
end
|
9
|
+
end
|
2
10
|
def timestamp(timedate=nil)
|
3
11
|
return "Never" if timedate.blank?
|
4
12
|
return Time.now() - timedate > 604800 ? timedate.strftime("%B %d") + ' at ' + timedate.strftime("%I:%M %p") : time_ago_in_words(timedate) + ' ago'
|
5
13
|
end
|
6
14
|
|
7
15
|
def current_admin_site_name
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
return
|
14
|
-
|
16
|
+
site_name = Spud::Core.site_name
|
17
|
+
if Spud::Core.multisite_mode_enabled && !session[:admin_site].blank?
|
18
|
+
config = Spud::Core.multisite_config.select{|p| p[:site_id].to_i == session[:admin_site].to_i}
|
19
|
+
site_name = config[0][:site_name] if !config.blank?
|
20
|
+
end
|
21
|
+
return site_name
|
15
22
|
end
|
16
23
|
|
17
|
-
def current_site_name
|
18
|
-
return Spud::Core.site_name if !Spud::Core.multisite_mode_enabled
|
19
|
-
config = Spud::Core.site_config_for_host(request.host_with_port)
|
20
|
-
return Spud::Core.site_name if config.blank?
|
21
|
-
|
22
|
-
return config[:site_name]
|
23
|
-
end
|
24
24
|
def header_style
|
25
|
-
|
26
|
-
|
25
|
+
style_str = ''
|
26
|
+
if Spud::Core.multisite_mode_enabled
|
27
|
+
config = Spud::Core.multisite_config.select{|p| p[:site_id].to_i == session[:admin_site].to_i}
|
28
|
+
style_str = config[0][:header_style] if !config.blank? && config[0].has_key?(:header_style)
|
27
29
|
end
|
28
|
-
|
29
|
-
return '' if config.blank?
|
30
|
-
|
31
|
-
return config[0][:header_style]
|
30
|
+
return style_str
|
32
31
|
end
|
33
32
|
|
34
33
|
def link_to_remove_fields(name, f)
|
35
34
|
f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)",:class => "btn btn-danger")
|
36
35
|
end
|
37
|
-
|
36
|
+
|
38
37
|
def link_to_add_fields(name, f, association)
|
39
38
|
new_object = f.object.class.reflect_on_association(association).klass.new
|
40
39
|
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
|
@@ -55,6 +54,6 @@ module Spud::Admin::ApplicationHelper
|
|
55
54
|
content +="</ul></div>"
|
56
55
|
end
|
57
56
|
return content.html_safe
|
58
|
-
|
57
|
+
|
59
58
|
end
|
60
|
-
end
|
59
|
+
end
|