adminpanel 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -2
- data/.ruby-version +1 -0
- data/.travis.yml +8 -8
- data/Gemfile +26 -24
- data/README.md +57 -57
- data/adminpanel.gemspec +41 -39
- data/app/assets/fonts/fontawesome-webfont.svg +254 -254
- data/app/assets/javascripts/adminpanel/bootstrap-datepicker.js +1159 -1159
- data/app/assets/javascripts/adminpanel/bootstrap-timepicker.js +803 -803
- data/app/assets/javascripts/adminpanel/bootstrap.js +2170 -2170
- data/app/assets/javascripts/adminpanel/{products.js → images_form.js} +13 -13
- data/app/assets/javascripts/adminpanel/imagesloaded.js +12 -12
- data/app/assets/javascripts/adminpanel/jquery.dataTables.min.js +155 -155
- data/app/assets/javascripts/adminpanel/jquery.facybox.js +395 -395
- data/app/assets/javascripts/adminpanel/jquery.masonry.min.js +9 -9
- data/app/assets/javascripts/adminpanel/jquery.slimscroll.min.js +13 -13
- data/app/assets/javascripts/adminpanel/medium-editor.js +702 -702
- data/app/assets/javascripts/adminpanel/realm.js +87 -87
- data/app/assets/javascripts/adminpanel/tables.js +126 -126
- data/app/assets/javascripts/application-admin.js +15 -15
- data/app/assets/stylesheets/adminpanel/_clearfix.css.scss +7 -7
- data/app/assets/stylesheets/adminpanel/alertify.css +241 -241
- data/app/assets/stylesheets/adminpanel/bootstrap.css +6103 -6103
- data/app/assets/stylesheets/adminpanel/colorpicker.css +6 -6
- data/app/assets/stylesheets/adminpanel/datepicker.css +9 -9
- data/app/assets/stylesheets/adminpanel/elfinder.min.css +59 -59
- data/app/assets/stylesheets/adminpanel/facybox.css +146 -146
- data/app/assets/stylesheets/adminpanel/font-awesome.min.css +33 -33
- data/app/assets/stylesheets/adminpanel/fullcalendar.css +618 -618
- data/app/assets/stylesheets/adminpanel/fullcalendar.print.css +61 -61
- data/app/assets/stylesheets/adminpanel/select2.css +524 -524
- data/app/assets/stylesheets/adminpanel/theme.css +1571 -1571
- data/app/assets/stylesheets/adminpanel/timepicker.css +82 -82
- data/app/assets/stylesheets/application-admin.css +13 -13
- data/app/controllers/adminpanel/application_controller.rb +32 -17
- data/app/controllers/adminpanel/galleries_controller.rb +80 -80
- data/app/controllers/adminpanel/sections_controller.rb +45 -45
- data/app/controllers/adminpanel/sessions_controller.rb +26 -26
- data/app/controllers/adminpanel/users_controller.rb +84 -84
- data/app/helpers/adminpanel/application_helper.rb +41 -51
- data/app/helpers/adminpanel/breadcrumbs_helper.rb +16 -0
- data/app/helpers/adminpanel/custom_form_builder.rb +248 -0
- data/app/helpers/adminpanel/images_helper.rb +9 -9
- data/app/helpers/adminpanel/rest_actions_helper.rb +47 -0
- data/app/helpers/adminpanel/router_helper.rb +33 -0
- data/app/helpers/adminpanel/sessions_helper.rb +25 -25
- data/app/models/adminpanel/gallery.rb +60 -60
- data/app/models/adminpanel/image.rb +14 -14
- data/app/models/adminpanel/section.rb +22 -22
- data/app/models/adminpanel/user.rb +35 -35
- data/app/uploaders/adminpanel/gallery_uploader.rb +55 -55
- data/app/uploaders/adminpanel/image_uploader.rb +57 -57
- data/app/views/adminpanel/galleries/_galleries_table.html.erb +14 -14
- data/app/views/adminpanel/galleries/create.html.erb +2 -2
- data/app/views/adminpanel/galleries/delete.html.erb +2 -2
- data/app/views/adminpanel/galleries/edit.html.erb +25 -25
- data/app/views/adminpanel/galleries/index.html.erb +51 -51
- data/app/views/adminpanel/galleries/new.html.erb +17 -17
- data/app/views/adminpanel/galleries/show.html.erb +17 -17
- data/app/views/adminpanel/galleries/update.html.erb +2 -2
- data/app/views/adminpanel/sections/_image_fields.html.erb +23 -23
- data/app/views/adminpanel/sections/_sections_table.html.erb +16 -16
- data/app/views/adminpanel/sections/create.html.erb +2 -2
- data/app/views/adminpanel/sections/destroy.html.erb +2 -2
- data/app/views/adminpanel/sections/edit.html.erb +41 -41
- data/app/views/adminpanel/sections/index.html.erb +44 -44
- data/app/views/adminpanel/sections/new.html.erb +26 -26
- data/app/views/adminpanel/sections/show.html.erb +30 -30
- data/app/views/adminpanel/sections/update.html.erb +2 -2
- data/app/views/adminpanel/sessions/new.html.erb +25 -25
- data/app/views/adminpanel/users/_user_form.html.erb +20 -20
- data/app/views/adminpanel/users/edit.html.erb +5 -5
- data/app/views/adminpanel/users/index.html.erb +49 -49
- data/app/views/adminpanel/users/new.html.erb +5 -5
- data/app/views/adminpanel/users/show.html.erb +20 -20
- data/app/views/layouts/_shim.html.erb +3 -3
- data/app/views/layouts/_side_menu.html.erb +49 -43
- data/app/views/layouts/_top_bar.html.erb +43 -43
- data/app/views/layouts/admin-login.html.erb +28 -28
- data/app/views/layouts/admin.html.erb +41 -39
- data/app/views/shared/_breadcrumb.html.erb +6 -6
- data/app/views/shared/_error_messages.html.erb +16 -16
- data/app/views/shared/_form_fields.html.erb +25 -0
- data/app/views/{adminpanel/products → shared}/_image_fields.html.erb +23 -23
- data/app/views/shared/_init_editor.html.erb +24 -0
- data/app/views/shared/edit.html.erb +28 -0
- data/app/views/shared/index.html.erb +94 -0
- data/app/views/shared/new.html.erb +28 -0
- data/app/views/shared/show.html.erb +63 -0
- data/config/locales/en.yml +5 -5
- data/config/locales/es.yml +127 -129
- data/config/routes.rb +24 -16
- data/lib/adminpanel.rb +9 -7
- data/lib/adminpanel/active_record_extension.rb +38 -0
- data/lib/adminpanel/engine.rb +5 -5
- data/lib/adminpanel/version.rb +3 -3
- data/lib/generators/adminpanel/initialize/initialize_generator.rb +17 -0
- data/lib/generators/adminpanel/{install/templates/migrations → initialize/templates}/create_adminpanel_tables.rb +45 -64
- data/lib/generators/adminpanel/resource/resource_generator.rb +105 -0
- data/lib/generators/adminpanel/resource/templates/controller.rb +4 -0
- data/lib/generators/adminpanel/resource/templates/migration.rb +9 -0
- data/lib/generators/adminpanel/resource/templates/resource.rb +19 -0
- data/spec/dummy/.gitignore +17 -17
- data/spec/dummy/README.rdoc +261 -261
- data/spec/dummy/Rakefile +7 -7
- data/{app/views/adminpanel/categories/show.html.erb → spec/dummy/app/adminpanel/products.rb} +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -13
- data/spec/dummy/app/assets/stylesheets/application.css +13 -13
- data/spec/dummy/app/controllers/adminpanel/.gitkeep +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -11
- data/spec/dummy/app/helpers/application_helper.rb +2 -2
- data/spec/dummy/app/views/layouts/application.html.erb +14 -14
- data/spec/dummy/config.ru +4 -4
- data/spec/dummy/config/application.rb +62 -62
- data/spec/dummy/config/boot.rb +9 -9
- data/spec/dummy/config/carrierwve.rb +5 -5
- data/spec/dummy/config/database.yml +24 -24
- data/spec/dummy/config/environment.rb +5 -5
- data/spec/dummy/config/environments/development.rb +41 -41
- data/spec/dummy/config/environments/production.rb +72 -72
- data/spec/dummy/config/environments/test.rb +41 -41
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/spec/dummy/config/initializers/inflections.rb +15 -15
- data/spec/dummy/config/initializers/mime_types.rb +5 -5
- data/spec/dummy/config/initializers/secret_token.rb +8 -8
- data/spec/dummy/config/initializers/session_store.rb +8 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/spec/dummy/config/locales/en.yml +5 -5
- data/spec/dummy/config/routes.rb +4 -4
- data/spec/dummy/db/schema.rb +15 -15
- data/spec/dummy/public/404.html +26 -26
- data/spec/dummy/public/422.html +26 -26
- data/spec/dummy/public/500.html +25 -25
- data/spec/dummy/public/uploads/gallery/file/1/hipster.jpg +0 -0
- data/spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg +0 -0
- data/spec/dummy/script/rails +6 -6
- data/spec/features/authentication_pages_spec.rb +43 -43
- data/spec/features/galleries_pages_spec.rb +124 -124
- data/spec/features/section_pages_spec.rb +37 -37
- data/spec/features/user_pages_spec.rb +48 -48
- data/spec/generators/initialize_spec.rb +9 -0
- data/spec/generators/resource_spec.rb +122 -0
- data/spec/models/gallery_spec.rb +21 -21
- data/spec/models/section_spec.rb +66 -66
- data/spec/models/user_spec.rb +105 -105
- data/spec/spec_helper.rb +32 -31
- data/spec/support/define_factory_models.rb +25 -36
- data/spec/support/helper_methods.rb +26 -26
- data/spec/support/submit_forms_without_button.rb +16 -16
- data/spec/support/test_database.rb +45 -58
- data/spec/uploaders/gallery_uploader_spec.rb +36 -30
- data/spec/uploaders/image_uploader_spec.rb +30 -29
- metadata +208 -64
- checksums.yaml +0 -7
- data/app/assets/javascripts/adminpanel/init_editor.js +0 -28
- data/app/controllers/adminpanel/categories_controller.rb +0 -41
- data/app/controllers/adminpanel/products_controller.rb +0 -88
- data/app/helpers/custom_form_builder.rb +0 -219
- data/app/models/adminpanel/category.rb +0 -7
- data/app/models/adminpanel/product.rb +0 -24
- data/app/views/adminpanel/categories/edit.html.erb +0 -18
- data/app/views/adminpanel/categories/index.html.erb +0 -55
- data/app/views/adminpanel/categories/new.html.erb +0 -18
- data/app/views/adminpanel/products/.DS_Store +0 -0
- data/app/views/adminpanel/products/_product_form.html.erb +0 -31
- data/app/views/adminpanel/products/edit.html.erb +0 -10
- data/app/views/adminpanel/products/index.html.erb +0 -51
- data/app/views/adminpanel/products/new.html.erb +0 -10
- data/app/views/adminpanel/products/show.html.erb +0 -61
- data/config/database.yml +0 -24
- data/lib/generators/adminpanel/install/install_generator.rb +0 -12
- data/spec/features/categories_pages_spec.rb +0 -44
- data/spec/features/product_pages_spec.rb +0 -64
- data/spec/models/category_spec.rb +0 -58
- data/spec/models/product_spec.rb +0 -51
@@ -1,82 +1,82 @@
|
|
1
|
-
.bootstrap-timepicker.dropdown-menu {
|
2
|
-
border-radius: 4px 4px 4px 4px;
|
3
|
-
display: none;
|
4
|
-
left: 0;
|
5
|
-
margin-top: 1px;
|
6
|
-
padding: 4px;
|
7
|
-
top: 0;
|
8
|
-
min-width: 10px;
|
9
|
-
z-index: 99999;
|
10
|
-
}
|
11
|
-
.bootstrap-timepicker.dropdown-menu.open {
|
12
|
-
display: inline-block;
|
13
|
-
}
|
14
|
-
.bootstrap-timepicker.dropdown-menu:before {
|
15
|
-
border-bottom: 7px solid rgba(0, 0, 0, 0.2);
|
16
|
-
border-left: 7px solid transparent;
|
17
|
-
border-right: 7px solid transparent;
|
18
|
-
content: "";
|
19
|
-
left: 6px;
|
20
|
-
position: absolute;
|
21
|
-
top: -7px;
|
22
|
-
}
|
23
|
-
.bootstrap-timepicker.dropdown-menu:after {
|
24
|
-
border-bottom: 6px solid #FFFFFF;
|
25
|
-
border-left: 6px solid transparent;
|
26
|
-
border-right: 6px solid transparent;
|
27
|
-
content: "";
|
28
|
-
left: 7px;
|
29
|
-
position: absolute;
|
30
|
-
top: -6px;
|
31
|
-
}
|
32
|
-
.bootstrap-timepicker.modal {
|
33
|
-
margin-left: -100px;
|
34
|
-
margin-top: 0;
|
35
|
-
top: 30%;
|
36
|
-
width: 200px;
|
37
|
-
}
|
38
|
-
.bootstrap-timepicker.modal .modal-content {
|
39
|
-
padding: 0;
|
40
|
-
}
|
41
|
-
.bootstrap-timepicker table {
|
42
|
-
margin: 0;
|
43
|
-
width: 100%;
|
44
|
-
}
|
45
|
-
.bootstrap-timepicker table td {
|
46
|
-
height: 30px;
|
47
|
-
margin: 0;
|
48
|
-
padding: 2px;
|
49
|
-
text-align: center;
|
50
|
-
}
|
51
|
-
.bootstrap-timepicker table td span {
|
52
|
-
width: 100%;
|
53
|
-
}
|
54
|
-
.bootstrap-timepicker table td a {
|
55
|
-
border: 1px solid transparent;
|
56
|
-
display: inline-block;
|
57
|
-
margin: 0;
|
58
|
-
outline: 0 none;
|
59
|
-
padding: 8px 0;
|
60
|
-
width: 3em;
|
61
|
-
}
|
62
|
-
.bootstrap-timepicker table td a:hover {
|
63
|
-
background-color: #EEEEEE;
|
64
|
-
border-color: #DDDDDD;
|
65
|
-
border-radius: 4px 4px 4px 4px;
|
66
|
-
}
|
67
|
-
.bootstrap-timepicker table td a i {
|
68
|
-
margin-top: 2px;
|
69
|
-
}
|
70
|
-
.bootstrap-timepicker table td input {
|
71
|
-
margin: 0;
|
72
|
-
text-align: center;
|
73
|
-
width: 25px;
|
74
|
-
}
|
75
|
-
.bootstrap-timepicker-component .add-on {
|
76
|
-
cursor: pointer;
|
77
|
-
}
|
78
|
-
.bootstrap-timepicker-component .add-on i {
|
79
|
-
display: block;
|
80
|
-
height: 16px;
|
81
|
-
width: 16px;
|
82
|
-
}
|
1
|
+
.bootstrap-timepicker.dropdown-menu {
|
2
|
+
border-radius: 4px 4px 4px 4px;
|
3
|
+
display: none;
|
4
|
+
left: 0;
|
5
|
+
margin-top: 1px;
|
6
|
+
padding: 4px;
|
7
|
+
top: 0;
|
8
|
+
min-width: 10px;
|
9
|
+
z-index: 99999;
|
10
|
+
}
|
11
|
+
.bootstrap-timepicker.dropdown-menu.open {
|
12
|
+
display: inline-block;
|
13
|
+
}
|
14
|
+
.bootstrap-timepicker.dropdown-menu:before {
|
15
|
+
border-bottom: 7px solid rgba(0, 0, 0, 0.2);
|
16
|
+
border-left: 7px solid transparent;
|
17
|
+
border-right: 7px solid transparent;
|
18
|
+
content: "";
|
19
|
+
left: 6px;
|
20
|
+
position: absolute;
|
21
|
+
top: -7px;
|
22
|
+
}
|
23
|
+
.bootstrap-timepicker.dropdown-menu:after {
|
24
|
+
border-bottom: 6px solid #FFFFFF;
|
25
|
+
border-left: 6px solid transparent;
|
26
|
+
border-right: 6px solid transparent;
|
27
|
+
content: "";
|
28
|
+
left: 7px;
|
29
|
+
position: absolute;
|
30
|
+
top: -6px;
|
31
|
+
}
|
32
|
+
.bootstrap-timepicker.modal {
|
33
|
+
margin-left: -100px;
|
34
|
+
margin-top: 0;
|
35
|
+
top: 30%;
|
36
|
+
width: 200px;
|
37
|
+
}
|
38
|
+
.bootstrap-timepicker.modal .modal-content {
|
39
|
+
padding: 0;
|
40
|
+
}
|
41
|
+
.bootstrap-timepicker table {
|
42
|
+
margin: 0;
|
43
|
+
width: 100%;
|
44
|
+
}
|
45
|
+
.bootstrap-timepicker table td {
|
46
|
+
height: 30px;
|
47
|
+
margin: 0;
|
48
|
+
padding: 2px;
|
49
|
+
text-align: center;
|
50
|
+
}
|
51
|
+
.bootstrap-timepicker table td span {
|
52
|
+
width: 100%;
|
53
|
+
}
|
54
|
+
.bootstrap-timepicker table td a {
|
55
|
+
border: 1px solid transparent;
|
56
|
+
display: inline-block;
|
57
|
+
margin: 0;
|
58
|
+
outline: 0 none;
|
59
|
+
padding: 8px 0;
|
60
|
+
width: 3em;
|
61
|
+
}
|
62
|
+
.bootstrap-timepicker table td a:hover {
|
63
|
+
background-color: #EEEEEE;
|
64
|
+
border-color: #DDDDDD;
|
65
|
+
border-radius: 4px 4px 4px 4px;
|
66
|
+
}
|
67
|
+
.bootstrap-timepicker table td a i {
|
68
|
+
margin-top: 2px;
|
69
|
+
}
|
70
|
+
.bootstrap-timepicker table td input {
|
71
|
+
margin: 0;
|
72
|
+
text-align: center;
|
73
|
+
width: 25px;
|
74
|
+
}
|
75
|
+
.bootstrap-timepicker-component .add-on {
|
76
|
+
cursor: pointer;
|
77
|
+
}
|
78
|
+
.bootstrap-timepicker-component .add-on i {
|
79
|
+
display: block;
|
80
|
+
height: 16px;
|
81
|
+
width: 16px;
|
82
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
-
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
-
*
|
11
|
-
*= require_self
|
12
|
-
*= require adminpanel/medium-editor
|
13
|
-
*= require_tree ./adminpanel/.
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require adminpanel/medium-editor
|
13
|
+
*= require_tree ./adminpanel/.
|
14
14
|
*/
|
@@ -1,18 +1,33 @@
|
|
1
|
-
module Adminpanel
|
2
|
-
class ApplicationController < ::
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
1
|
+
module Adminpanel
|
2
|
+
class ApplicationController < ActionController::Base
|
3
|
+
protect_from_forgery
|
4
|
+
|
5
|
+
inherit_resources
|
6
|
+
|
7
|
+
include SessionsHelper
|
8
|
+
include RestActionsHelper
|
9
|
+
include RouterHelper
|
10
|
+
|
11
|
+
layout "admin"
|
12
|
+
|
13
|
+
before_filter :signed_in_user, :set_model, :get_menu_elements
|
14
|
+
|
15
|
+
|
16
|
+
def signed_in_user
|
17
|
+
redirect_to signin_url, :notice => "Favor de Iniciar sesion" unless signed_in?
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_model
|
21
|
+
@model = params[:controller].classify.constantize
|
22
|
+
end
|
23
|
+
|
24
|
+
def handle_unverified_request
|
25
|
+
sign_out
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_menu_elements
|
30
|
+
@menu_items = menu_items
|
31
|
+
end
|
32
|
+
end
|
18
33
|
end
|
@@ -1,81 +1,81 @@
|
|
1
|
-
module Adminpanel
|
2
|
-
class GalleriesController < Adminpanel::ApplicationController
|
3
|
-
def index
|
4
|
-
@galleries = Gallery.find(:all)
|
5
|
-
end
|
6
|
-
|
7
|
-
def show
|
8
|
-
@gallery = Gallery.find(params[:id])
|
9
|
-
end
|
10
|
-
|
11
|
-
def edit
|
12
|
-
@gallery = Gallery.find(params[:id])
|
13
|
-
end
|
14
|
-
|
15
|
-
def create
|
16
|
-
@gallery = Gallery.new(params[:gallery])
|
17
|
-
|
18
|
-
if @gallery.save
|
19
|
-
redirect_to gallery_path(@gallery), :notice => t("gallery.success")
|
20
|
-
else
|
21
|
-
render 'new'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def move_better
|
26
|
-
@gallery = Gallery.find(params[:id])
|
27
|
-
if @gallery.move_to_better_position
|
28
|
-
flash[:success] = t("gallery.moved")
|
29
|
-
else
|
30
|
-
flash[:warning] = t("gallery.not-moved")
|
31
|
-
end
|
32
|
-
respond_to do |format|
|
33
|
-
format.html do
|
34
|
-
redirect_to galleries_path
|
35
|
-
end
|
36
|
-
format.js do
|
37
|
-
@galleries = Gallery.all
|
38
|
-
render :locals => { :galleries => @galleries }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def move_worst
|
44
|
-
@gallery = Gallery.find(params[:id])
|
45
|
-
if @gallery.move_to_worst_position
|
46
|
-
flash[:success] = t("gallery.moved")
|
47
|
-
else
|
48
|
-
flash[:warning] = t("gallery.not-moved")
|
49
|
-
end
|
50
|
-
respond_to do |format|
|
51
|
-
format.html do
|
52
|
-
redirect_to galleries_path
|
53
|
-
end
|
54
|
-
format.js do
|
55
|
-
@galleries = Gallery.all
|
56
|
-
render :locals => { :galleries => @galleries }
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def destroy
|
62
|
-
@gallery = Gallery.find(params[:id])
|
63
|
-
@gallery.destroy
|
64
|
-
|
65
|
-
redirect_to galleries_path, :notice => t("gallery.deleted")
|
66
|
-
end
|
67
|
-
|
68
|
-
def update
|
69
|
-
@gallery = Gallery.find(params[:id])
|
70
|
-
if @gallery.update_attributes(params[:gallery])
|
71
|
-
redirect_to gallery_path(@gallery)
|
72
|
-
else
|
73
|
-
render 'edit'
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def new
|
78
|
-
@gallery = Gallery.new
|
79
|
-
end
|
80
|
-
end
|
1
|
+
module Adminpanel
|
2
|
+
class GalleriesController < Adminpanel::ApplicationController
|
3
|
+
def index
|
4
|
+
@galleries = Gallery.find(:all)
|
5
|
+
end
|
6
|
+
|
7
|
+
def show
|
8
|
+
@gallery = Gallery.find(params[:id])
|
9
|
+
end
|
10
|
+
|
11
|
+
def edit
|
12
|
+
@gallery = Gallery.find(params[:id])
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
@gallery = Gallery.new(params[:gallery])
|
17
|
+
|
18
|
+
if @gallery.save
|
19
|
+
redirect_to gallery_path(@gallery), :notice => t("gallery.success")
|
20
|
+
else
|
21
|
+
render 'new'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def move_better
|
26
|
+
@gallery = Gallery.find(params[:id])
|
27
|
+
if @gallery.move_to_better_position
|
28
|
+
flash[:success] = t("gallery.moved")
|
29
|
+
else
|
30
|
+
flash[:warning] = t("gallery.not-moved")
|
31
|
+
end
|
32
|
+
respond_to do |format|
|
33
|
+
format.html do
|
34
|
+
redirect_to galleries_path
|
35
|
+
end
|
36
|
+
format.js do
|
37
|
+
@galleries = Gallery.all
|
38
|
+
render :locals => { :galleries => @galleries }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def move_worst
|
44
|
+
@gallery = Gallery.find(params[:id])
|
45
|
+
if @gallery.move_to_worst_position
|
46
|
+
flash[:success] = t("gallery.moved")
|
47
|
+
else
|
48
|
+
flash[:warning] = t("gallery.not-moved")
|
49
|
+
end
|
50
|
+
respond_to do |format|
|
51
|
+
format.html do
|
52
|
+
redirect_to galleries_path
|
53
|
+
end
|
54
|
+
format.js do
|
55
|
+
@galleries = Gallery.all
|
56
|
+
render :locals => { :galleries => @galleries }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def destroy
|
62
|
+
@gallery = Gallery.find(params[:id])
|
63
|
+
@gallery.destroy
|
64
|
+
|
65
|
+
redirect_to galleries_path, :notice => t("gallery.deleted")
|
66
|
+
end
|
67
|
+
|
68
|
+
def update
|
69
|
+
@gallery = Gallery.find(params[:id])
|
70
|
+
if @gallery.update_attributes(params[:gallery])
|
71
|
+
redirect_to gallery_path(@gallery)
|
72
|
+
else
|
73
|
+
render 'edit'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def new
|
78
|
+
@gallery = Gallery.new
|
79
|
+
end
|
80
|
+
end
|
81
81
|
end
|
@@ -1,46 +1,46 @@
|
|
1
|
-
module Adminpanel
|
2
|
-
class SectionsController < Adminpanel::ApplicationController
|
3
|
-
def new
|
4
|
-
@section = Section.new
|
5
|
-
end
|
6
|
-
|
7
|
-
# def create
|
8
|
-
# @section = Section.new(params[:section])
|
9
|
-
|
10
|
-
# if @section.save
|
11
|
-
# redirect_to section_path(@section), :notice => 'La seccion ha sido creada'
|
12
|
-
# else
|
13
|
-
# render 'new'
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
|
17
|
-
def edit
|
18
|
-
@section = Section.find(params[:id])
|
19
|
-
end
|
20
|
-
|
21
|
-
def update
|
22
|
-
@section = Section.find(params[:id])
|
23
|
-
|
24
|
-
if @section.update_attributes(params[:section])
|
25
|
-
redirect_to section_path(@section), :notice => "La seccion se ha actualizado"
|
26
|
-
else
|
27
|
-
render 'edit'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def show
|
32
|
-
@section = Section.find(params[:id])
|
33
|
-
end
|
34
|
-
|
35
|
-
# def destroy
|
36
|
-
# @section = Section.find(params[:id])
|
37
|
-
# @section.destroy
|
38
|
-
|
39
|
-
# redirect_to sections_path
|
40
|
-
# end
|
41
|
-
|
42
|
-
def index
|
43
|
-
@sections = Section.all
|
44
|
-
end
|
45
|
-
end
|
1
|
+
module Adminpanel
|
2
|
+
class SectionsController < Adminpanel::ApplicationController
|
3
|
+
def new
|
4
|
+
@section = Section.new
|
5
|
+
end
|
6
|
+
|
7
|
+
# def create
|
8
|
+
# @section = Section.new(params[:section])
|
9
|
+
|
10
|
+
# if @section.save
|
11
|
+
# redirect_to section_path(@section), :notice => 'La seccion ha sido creada'
|
12
|
+
# else
|
13
|
+
# render 'new'
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
|
17
|
+
def edit
|
18
|
+
@section = Section.find(params[:id])
|
19
|
+
end
|
20
|
+
|
21
|
+
def update
|
22
|
+
@section = Section.find(params[:id])
|
23
|
+
|
24
|
+
if @section.update_attributes(params[:section])
|
25
|
+
redirect_to section_path(@section), :notice => "La seccion se ha actualizado"
|
26
|
+
else
|
27
|
+
render 'edit'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def show
|
32
|
+
@section = Section.find(params[:id])
|
33
|
+
end
|
34
|
+
|
35
|
+
# def destroy
|
36
|
+
# @section = Section.find(params[:id])
|
37
|
+
# @section.destroy
|
38
|
+
|
39
|
+
# redirect_to sections_path
|
40
|
+
# end
|
41
|
+
|
42
|
+
def index
|
43
|
+
@sections = Section.all
|
44
|
+
end
|
45
|
+
end
|
46
46
|
end
|