simple_showcase_admin 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/simple_showcase_admin/settings_controller.rb +16 -0
- data/app/models/simple_showcase_admin/setting.rb +5 -0
- data/app/views/layouts/simple_showcase_admin/application.html.haml +2 -0
- data/app/views/simple_showcase_admin/settings/index.html.haml +9 -0
- data/config/routes.rb +3 -0
- data/db/migrate/019_create_settings.rb +17 -0
- data/lib/simple_showcase_admin/engine.rb +1 -0
- data/lib/simple_showcase_admin/version.rb +1 -1
- metadata +22 -2
@@ -0,0 +1,16 @@
|
|
1
|
+
module SimpleShowcaseAdmin
|
2
|
+
class SettingsController < SimpleShowcaseAdmin::ApplicationController
|
3
|
+
def index
|
4
|
+
@settings = Setting.all
|
5
|
+
end
|
6
|
+
|
7
|
+
def update
|
8
|
+
params[:settings].each_pair do |setting, value|
|
9
|
+
Setting.send("#{setting}=", value)
|
10
|
+
end
|
11
|
+
|
12
|
+
redirect_to [:admin, :settings], :notice => 'Settings updated' # Redirect to the settings index
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -42,6 +42,8 @@
|
|
42
42
|
%li.dropdown
|
43
43
|
= link_to "<i class='icon-user icon-white'></i> #{current_user.first_name} <b class='caret'></b>".html_safe, '#', :class => 'dropdown-toggle', "data-toggle" => "dropdown"
|
44
44
|
%ul.dropdown-menu
|
45
|
+
- unless SimpleShowcaseAdmin::Setting.all.blank?
|
46
|
+
%li= link_to 'Settings', settings_path
|
45
47
|
%li= link_to 'Your Details', detail_path(current_user)
|
46
48
|
%li.divider
|
47
49
|
%li= link_to 'Log Out', logout_path
|
@@ -0,0 +1,9 @@
|
|
1
|
+
= form_tag("/admin/settings", method: 'put') do
|
2
|
+
- unless @settings.blank?
|
3
|
+
- @settings.each do |key, value|
|
4
|
+
= fields_for :settings do |s|
|
5
|
+
= s.label key, key.titleize
|
6
|
+
= s.text_field key, value: value
|
7
|
+
.form-actions
|
8
|
+
= submit_tag self.controller.action_name == 'new' ? 'Create' : 'Update', :class => 'btn-primary'
|
9
|
+
|
data/config/routes.rb
CHANGED
@@ -4,6 +4,9 @@ SimpleShowcaseAdmin::Engine.routes.draw do
|
|
4
4
|
match '/login' => 'sessions#new', :as => 'login'
|
5
5
|
get 'logout' => 'sessions#destroy', :as => 'logout'
|
6
6
|
|
7
|
+
match 'settings', to: 'settings#update', as: 'settings', via: [:put]
|
8
|
+
match 'settings', to: 'settings#index', as: 'settings', via: [:get, :put]
|
9
|
+
|
7
10
|
resources :categories do
|
8
11
|
post :sort, on: :collection
|
9
12
|
resources :items do
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateSettings < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :settings do |t|
|
4
|
+
t.string :var, :null => false
|
5
|
+
t.text :value, :null => true
|
6
|
+
t.integer :thing_id, :null => true
|
7
|
+
t.string :thing_type, :limit => 30, :null => true
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :settings, [ :thing_type, :thing_id, :var ], :unique => true
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table :settings
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_showcase_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -313,6 +313,22 @@ dependencies:
|
|
313
313
|
- - ! '>='
|
314
314
|
- !ruby/object:Gem::Version
|
315
315
|
version: '0'
|
316
|
+
- !ruby/object:Gem::Dependency
|
317
|
+
name: rails-settings-cached
|
318
|
+
requirement: !ruby/object:Gem::Requirement
|
319
|
+
none: false
|
320
|
+
requirements:
|
321
|
+
- - '='
|
322
|
+
- !ruby/object:Gem::Version
|
323
|
+
version: 0.2.4
|
324
|
+
type: :runtime
|
325
|
+
prerelease: false
|
326
|
+
version_requirements: !ruby/object:Gem::Requirement
|
327
|
+
none: false
|
328
|
+
requirements:
|
329
|
+
- - '='
|
330
|
+
- !ruby/object:Gem::Version
|
331
|
+
version: 0.2.4
|
316
332
|
- !ruby/object:Gem::Dependency
|
317
333
|
name: rspec-rails
|
318
334
|
requirement: !ruby/object:Gem::Requirement
|
@@ -366,6 +382,7 @@ files:
|
|
366
382
|
- app/controllers/simple_showcase_admin/pages_controller.rb
|
367
383
|
- app/controllers/simple_showcase_admin/password_resets_controller.rb
|
368
384
|
- app/controllers/simple_showcase_admin/sessions_controller.rb
|
385
|
+
- app/controllers/simple_showcase_admin/settings_controller.rb
|
369
386
|
- app/helpers/simple_showcase_admin/application_helper.rb
|
370
387
|
- app/helpers/simple_showcase_admin/items_helper.rb
|
371
388
|
- app/mailers/simple_showcase_admin/user_mailer.rb
|
@@ -373,6 +390,7 @@ files:
|
|
373
390
|
- app/models/simple_showcase_admin/item.rb
|
374
391
|
- app/models/simple_showcase_admin/page.rb
|
375
392
|
- app/models/simple_showcase_admin/photo.rb
|
393
|
+
- app/models/simple_showcase_admin/setting.rb
|
376
394
|
- app/models/simple_showcase_admin/user.rb
|
377
395
|
- app/uploaders/image_uploader.rb
|
378
396
|
- app/views/layouts/simple_showcase_admin/application.html.haml
|
@@ -394,6 +412,7 @@ files:
|
|
394
412
|
- app/views/simple_showcase_admin/password_resets/edit.html.haml
|
395
413
|
- app/views/simple_showcase_admin/password_resets/new.html.haml
|
396
414
|
- app/views/simple_showcase_admin/sessions/new.html.haml
|
415
|
+
- app/views/simple_showcase_admin/settings/index.html.haml
|
397
416
|
- app/views/simple_showcase_admin/user_mailer/reset_password_email.html.haml
|
398
417
|
- config/initializers/simple_form.rb
|
399
418
|
- config/initializers/sorcery.rb
|
@@ -416,6 +435,7 @@ files:
|
|
416
435
|
- db/migrate/016_add_row_order_to_items.rb
|
417
436
|
- db/migrate/017_create_simple_showcase_admin_pages.rb
|
418
437
|
- db/migrate/018_add_rendered_text_to_simple_showcase_admin_pages.rb
|
438
|
+
- db/migrate/019_create_settings.rb
|
419
439
|
- lib/generators/simple_showcase_admin/install_generator.rb
|
420
440
|
- lib/simple_showcase_admin/configuration.rb
|
421
441
|
- lib/simple_showcase_admin/engine.rb
|