adminpanel 0.0.1
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/.gitignore +17 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +1 -0
- data/adminpanel.gemspec +32 -0
- data/app/assets/fonts/.DS_Store +0 -0
- data/app/assets/fonts/FontAwesome.otf +0 -0
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +255 -0
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/images/adminpanel/alpha.png +0 -0
- data/app/assets/images/adminpanel/arrows-active.png +0 -0
- data/app/assets/images/adminpanel/arrows-normal.png +0 -0
- data/app/assets/images/adminpanel/bgnoise.png +0 -0
- data/app/assets/images/adminpanel/crop.gif +0 -0
- data/app/assets/images/adminpanel/dialogs.png +0 -0
- data/app/assets/images/adminpanel/dotted.png +0 -0
- data/app/assets/images/adminpanel/favicon.ico +0 -0
- data/app/assets/images/adminpanel/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/adminpanel/glyphicons-halflings.png +0 -0
- data/app/assets/images/adminpanel/gritter-light.png +0 -0
- data/app/assets/images/adminpanel/gritter-long.png +0 -0
- data/app/assets/images/adminpanel/gritter.png +0 -0
- data/app/assets/images/adminpanel/hue.png +0 -0
- data/app/assets/images/adminpanel/icons-big.png +0 -0
- data/app/assets/images/adminpanel/icons-small.png +0 -0
- data/app/assets/images/adminpanel/ie-spacer.gif +0 -0
- data/app/assets/images/adminpanel/odinn.jpg +0 -0
- data/app/assets/images/adminpanel/pattern.jpg +0 -0
- data/app/assets/images/adminpanel/pattern_transp.png +0 -0
- data/app/assets/images/adminpanel/progress.gif +0 -0
- data/app/assets/images/adminpanel/quicklook-bg.png +0 -0
- data/app/assets/images/adminpanel/quicklook-icons.png +0 -0
- data/app/assets/images/adminpanel/rails.png +0 -0
- data/app/assets/images/adminpanel/resize.png +0 -0
- data/app/assets/images/adminpanel/saturation.png +0 -0
- data/app/assets/images/adminpanel/select2.png +0 -0
- data/app/assets/images/adminpanel/select2x2.png +0 -0
- data/app/assets/images/adminpanel/sidebar.png +0 -0
- data/app/assets/images/adminpanel/sort_asc.png +0 -0
- data/app/assets/images/adminpanel/sort_asc_disabled.png +0 -0
- data/app/assets/images/adminpanel/sort_both.png +0 -0
- data/app/assets/images/adminpanel/sort_desc.png +0 -0
- data/app/assets/images/adminpanel/sort_desc_disabled.png +0 -0
- data/app/assets/images/adminpanel/spinner-mini.gif +0 -0
- data/app/assets/images/adminpanel/spinner.gif +0 -0
- data/app/assets/images/adminpanel/toolbar.png +0 -0
- data/app/assets/javascripts/adminpanel/bootstrap-datepicker.js +1159 -0
- data/app/assets/javascripts/adminpanel/bootstrap-timepicker.js +803 -0
- data/app/assets/javascripts/adminpanel/bootstrap.js +2170 -0
- data/app/assets/javascripts/adminpanel/imagesloaded.js +13 -0
- data/app/assets/javascripts/adminpanel/init_editor.js +28 -0
- data/app/assets/javascripts/adminpanel/jquery.dataTables.min.js +155 -0
- data/app/assets/javascripts/adminpanel/jquery.facybox.js +395 -0
- data/app/assets/javascripts/adminpanel/jquery.masonry.min.js +10 -0
- data/app/assets/javascripts/adminpanel/jquery.slimscroll.min.js +14 -0
- data/app/assets/javascripts/adminpanel/medium-editor.js +703 -0
- data/app/assets/javascripts/adminpanel/products.js +14 -0
- data/app/assets/javascripts/adminpanel/realm.js +90 -0
- data/app/assets/javascripts/adminpanel/tables.js +126 -0
- data/app/assets/javascripts/application-admin.js +16 -0
- data/app/assets/stylesheets/adminpanel/_clearfix.css.scss +8 -0
- data/app/assets/stylesheets/adminpanel/alertify.css +242 -0
- data/app/assets/stylesheets/adminpanel/bootstrap.css +6103 -0
- data/app/assets/stylesheets/adminpanel/colorpicker.css +7 -0
- data/app/assets/stylesheets/adminpanel/datepicker.css +9 -0
- data/app/assets/stylesheets/adminpanel/elfinder.min.css +59 -0
- data/app/assets/stylesheets/adminpanel/facybox.css +146 -0
- data/app/assets/stylesheets/adminpanel/font-awesome.min.css +34 -0
- data/app/assets/stylesheets/adminpanel/fullcalendar.css +618 -0
- data/app/assets/stylesheets/adminpanel/fullcalendar.print.css +61 -0
- data/app/assets/stylesheets/adminpanel/medium-editor.css.scss +1 -0
- data/app/assets/stylesheets/adminpanel/select2.css +524 -0
- data/app/assets/stylesheets/adminpanel/theme.css +1563 -0
- data/app/assets/stylesheets/adminpanel/timepicker.css +82 -0
- data/app/assets/stylesheets/application-admin.css +14 -0
- data/app/controllers/adminpanel/application_controller.rb +18 -0
- data/app/controllers/adminpanel/categories_controller.rb +41 -0
- data/app/controllers/adminpanel/galleries_controller.rb +45 -0
- data/app/controllers/adminpanel/products_controller.rb +87 -0
- data/app/controllers/adminpanel/sections_controller.rb +46 -0
- data/app/controllers/adminpanel/sessions_controller.rb +26 -0
- data/app/controllers/adminpanel/users_controller.rb +85 -0
- data/app/helpers/adminpanel/application_helper.rb +73 -0
- data/app/helpers/custom_form_builder.rb +219 -0
- data/app/models/adminpanel/category.rb +7 -0
- data/app/models/adminpanel/contact.rb +25 -0
- data/app/models/adminpanel/gallery.rb +10 -0
- data/app/models/adminpanel/image.rb +6 -0
- data/app/models/adminpanel/product.rb +24 -0
- data/app/models/adminpanel/section.rb +16 -0
- data/app/models/adminpanel/user.rb +35 -0
- data/app/uploaders/adminpanel/gallery_uploader.rb +56 -0
- data/app/uploaders/adminpanel/image_uploader.rb +63 -0
- data/app/uploaders/adminpanel/section_uploader.rb +56 -0
- data/app/views/adminpanel/.DS_Store +0 -0
- data/app/views/adminpanel/categories/edit.html.erb +18 -0
- data/app/views/adminpanel/categories/index.html.erb +55 -0
- data/app/views/adminpanel/categories/new.html.erb +18 -0
- data/app/views/adminpanel/categories/show.html.erb +0 -0
- data/app/views/adminpanel/galleries/create.html.erb +2 -0
- data/app/views/adminpanel/galleries/delete.html.erb +2 -0
- data/app/views/adminpanel/galleries/edit.html.erb +26 -0
- data/app/views/adminpanel/galleries/index.html.erb +60 -0
- data/app/views/adminpanel/galleries/new.html.erb +18 -0
- data/app/views/adminpanel/galleries/show.html.erb +18 -0
- data/app/views/adminpanel/galleries/update.html.erb +2 -0
- data/app/views/adminpanel/products/.DS_Store +0 -0
- data/app/views/adminpanel/products/_image_fields.html.erb +24 -0
- data/app/views/adminpanel/products/_product_form.html.erb +31 -0
- data/app/views/adminpanel/products/edit.html.erb +10 -0
- data/app/views/adminpanel/products/index.html.erb +57 -0
- data/app/views/adminpanel/products/new.html.erb +10 -0
- data/app/views/adminpanel/products/show.html.erb +61 -0
- data/app/views/adminpanel/sections/_image_fields.html.erb +24 -0
- data/app/views/adminpanel/sections/create.html.erb +2 -0
- data/app/views/adminpanel/sections/destroy.html.erb +2 -0
- data/app/views/adminpanel/sections/edit.html.erb +40 -0
- data/app/views/adminpanel/sections/index.html.erb +38 -0
- data/app/views/adminpanel/sections/new.html.erb +27 -0
- data/app/views/adminpanel/sections/show.html.erb +28 -0
- data/app/views/adminpanel/sections/update.html.erb +2 -0
- data/app/views/adminpanel/sessions/new.html.erb +26 -0
- data/app/views/adminpanel/users/_form.html.erb +33 -0
- data/app/views/adminpanel/users/edit.html.erb +22 -0
- data/app/views/adminpanel/users/index.html.erb +55 -0
- data/app/views/adminpanel/users/new.html.erb +22 -0
- data/app/views/adminpanel/users/show.html.erb +21 -0
- data/app/views/layouts/_shim.html.erb +4 -0
- data/app/views/layouts/_side_menu.html.erb +45 -0
- data/app/views/layouts/_top_bar.html.erb +43 -0
- data/app/views/layouts/admin.html.erb +45 -0
- data/app/views/shared/_breadcrumb.html.erb +6 -0
- data/app/views/shared/_error_messages.html.erb +17 -0
- data/config/locales/en.yml +5 -0
- data/config/locales/es.yml +202 -0
- data/config/routes.rb +11 -0
- data/lib/adminpanel.rb +8 -0
- data/lib/adminpanel/engine.rb +5 -0
- data/lib/adminpanel/version.rb +3 -0
- metadata +349 -0
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +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/.
|
|
14
|
+
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Adminpanel
|
|
2
|
+
class ApplicationController < ::ApplicationController
|
|
3
|
+
layout "admin"
|
|
4
|
+
# protect_from_forgery
|
|
5
|
+
# include helper :sessions
|
|
6
|
+
|
|
7
|
+
# before_filter :signed_in_user
|
|
8
|
+
|
|
9
|
+
# def signed_in_user
|
|
10
|
+
# redirect_to signin_url, :notice => "Favor de Iniciar sesion" unless signed_in?
|
|
11
|
+
# end
|
|
12
|
+
|
|
13
|
+
# def handle_unverified_request
|
|
14
|
+
# sign_out
|
|
15
|
+
# super
|
|
16
|
+
# end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module Adminpanel
|
|
2
|
+
class CategoriesController < Adminpanel::ApplicationController
|
|
3
|
+
def index
|
|
4
|
+
@categories = Category.all
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def new
|
|
8
|
+
@category = Category.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create
|
|
12
|
+
@category = Category.new(params[:category])
|
|
13
|
+
if @category.save
|
|
14
|
+
redirect_to categories_path, :notice => "La categoria ha sido guardada"
|
|
15
|
+
else
|
|
16
|
+
render "new"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def edit
|
|
21
|
+
@category = Category.find(params[:id])
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def update
|
|
25
|
+
@category = Category.find(params[:id])
|
|
26
|
+
|
|
27
|
+
if @category.update_attributes(params[:category])
|
|
28
|
+
redirect_to categories_path, :notice => "#{@category.name} ha sido actualizado con exito"
|
|
29
|
+
else
|
|
30
|
+
render "edit"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def destroy
|
|
35
|
+
@category = Category.find(params[:id])
|
|
36
|
+
@category.destroy
|
|
37
|
+
|
|
38
|
+
redirect_to categories_path
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Adminpanel
|
|
2
|
+
class GalleriesController < Adminpanel::ApplicationController
|
|
3
|
+
def index
|
|
4
|
+
@galleries = Gallery.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 => "La imagen ha sido creada"
|
|
20
|
+
else
|
|
21
|
+
render 'new'
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def destroy
|
|
26
|
+
@gallery = Gallery.find(params[:id])
|
|
27
|
+
@gallery.destroy
|
|
28
|
+
|
|
29
|
+
redirect_to galleries_path, :notice => "La imagen ha sido eliminada"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def update
|
|
33
|
+
@gallery = Gallery.find(params[:id])
|
|
34
|
+
if @gallery.update_attributes(params[:gallery])
|
|
35
|
+
redirect_to gallery_path(@gallery)
|
|
36
|
+
else
|
|
37
|
+
render 'edit'
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def new
|
|
42
|
+
@gallery = Gallery.new
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
module Adminpanel
|
|
2
|
+
class ProductsController < Adminpanel::ApplicationController
|
|
3
|
+
# GET /admin/products
|
|
4
|
+
# GET /admin/products.json
|
|
5
|
+
def index
|
|
6
|
+
@products = Product.all
|
|
7
|
+
|
|
8
|
+
respond_to do |format|
|
|
9
|
+
format.html # index.html.erb
|
|
10
|
+
format.json { render :json => @products }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# GET /admin/products/1
|
|
15
|
+
# GET /admin/products/1.json
|
|
16
|
+
def show
|
|
17
|
+
@product = Product.find(params[:id])
|
|
18
|
+
|
|
19
|
+
respond_to do |format|
|
|
20
|
+
format.html # show.html.erb
|
|
21
|
+
format.json { render :json => @product }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# GET /admin/products/new
|
|
26
|
+
# GET /admin/products/new.json
|
|
27
|
+
def new
|
|
28
|
+
@product = Product.new
|
|
29
|
+
@categories = Category.all.collect{|c| [ c.name, c.id ] }
|
|
30
|
+
|
|
31
|
+
respond_to do |format|
|
|
32
|
+
format.html # new.html.erb
|
|
33
|
+
format.json { render :json => @product }
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# GET /admin/products/1/edit
|
|
38
|
+
def edit
|
|
39
|
+
@product = Product.find(params[:id])
|
|
40
|
+
@categories = Category.all.collect{|c| [ c.name, c.id ] }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# POST /admin/products
|
|
44
|
+
# POST /admin/products.json
|
|
45
|
+
def create
|
|
46
|
+
@product = Product.new(params[:product])
|
|
47
|
+
|
|
48
|
+
respond_to do |format|
|
|
49
|
+
if @product.save
|
|
50
|
+
format.html { redirect_to product_path(@product), :notice => 'Product was successfully created.' }
|
|
51
|
+
format.json { render :json => product_path(@product), :status => :created, :location => @product }
|
|
52
|
+
else
|
|
53
|
+
format.html { render :action => "new" }
|
|
54
|
+
format.json { render :json => @product.errors, :status => :unprocessable_entity }
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# PUT /admin/products/1
|
|
60
|
+
# PUT /admin/products/1.json
|
|
61
|
+
def update
|
|
62
|
+
@product = Product.find(params[:id])
|
|
63
|
+
|
|
64
|
+
respond_to do |format|
|
|
65
|
+
if @product.update_attributes(params[:product])
|
|
66
|
+
format.html { redirect_to product_path(@product), :notice => 'Product was successfully updated.' }
|
|
67
|
+
format.json { head :no_content }
|
|
68
|
+
else
|
|
69
|
+
format.html { render :action => "edit" }
|
|
70
|
+
format.json { render :json => @product.errors, :status => :unprocessable_entity }
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# DELETE /admin/products/1
|
|
76
|
+
# DELETE /admin/products/1.json
|
|
77
|
+
def destroy
|
|
78
|
+
@product = Product.find(params[:id])
|
|
79
|
+
@product.destroy
|
|
80
|
+
|
|
81
|
+
respond_to do |format|
|
|
82
|
+
format.html { redirect_to products_url }
|
|
83
|
+
format.json { head :no_content }
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +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
|
|
46
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Adminpanel
|
|
2
|
+
class SessionsController < Adminpanel::ApplicationController
|
|
3
|
+
layout 'sessions'
|
|
4
|
+
skip_before_filter :signed_in_user
|
|
5
|
+
|
|
6
|
+
def new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create
|
|
10
|
+
user = Admin::User.find_by_email(params[:session][:email].downcase)
|
|
11
|
+
if user && user.authenticate(params[:session][:password])
|
|
12
|
+
sign_in user
|
|
13
|
+
flash[:success] = "Bienvenido!"
|
|
14
|
+
redirect_to root_url
|
|
15
|
+
else
|
|
16
|
+
flash.now[:error] = "Password Incorrecto"
|
|
17
|
+
render 'new'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def destroy
|
|
22
|
+
sign_out
|
|
23
|
+
redirect_to root_url
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
module Adminpanel
|
|
2
|
+
class UsersController < Adminpanel::ApplicationController
|
|
3
|
+
# GET /admin/users
|
|
4
|
+
# GET /admin/users.json
|
|
5
|
+
def index
|
|
6
|
+
@users = User.all
|
|
7
|
+
|
|
8
|
+
respond_to do |format|
|
|
9
|
+
format.html # index.html.erb
|
|
10
|
+
format.json { render :json => @users }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# GET /admin/users/1
|
|
15
|
+
# GET /admin/users/1.json
|
|
16
|
+
def show
|
|
17
|
+
@user = User.find(params[:id])
|
|
18
|
+
|
|
19
|
+
respond_to do |format|
|
|
20
|
+
format.html # show.html.erb
|
|
21
|
+
format.json { render :json => @user }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# GET /admin/users/new
|
|
26
|
+
# GET /admin/users/new.json
|
|
27
|
+
def new
|
|
28
|
+
@user = User.new
|
|
29
|
+
|
|
30
|
+
respond_to do |format|
|
|
31
|
+
format.html # new.html.erb
|
|
32
|
+
format.json { render :json => @user }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# GET /admin/users/1/edit
|
|
37
|
+
def edit
|
|
38
|
+
@user = User.find(params[:id])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# POST /admin/users
|
|
42
|
+
# POST /admin/users.json
|
|
43
|
+
def create
|
|
44
|
+
@user = User.new(params[:user])
|
|
45
|
+
|
|
46
|
+
respond_to do |format|
|
|
47
|
+
if @user.save
|
|
48
|
+
format.html { redirect_to @user, :notice => 'Se ha creado con exito.' }
|
|
49
|
+
format.json { render :json => @user, :status => :created, :location => @user }
|
|
50
|
+
else
|
|
51
|
+
format.html { render :action => "new" }
|
|
52
|
+
format.json { render :json => @user.errors, :status => :unprocessable_entity }
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# PUT /admin/users/1
|
|
58
|
+
# PUT /admin/users/1.json
|
|
59
|
+
def update
|
|
60
|
+
@user = User.find(params[:id])
|
|
61
|
+
|
|
62
|
+
respond_to do |format|
|
|
63
|
+
if @user.update_attributes(params[:user])
|
|
64
|
+
format.html { redirect_to @user, :notice => 'Se ha actualizado con exito.' }
|
|
65
|
+
format.json { head :no_content }
|
|
66
|
+
else
|
|
67
|
+
format.html { render :action => "edit" }
|
|
68
|
+
format.json { render :json => @user.errors, :status => :unprocessable_entity }
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# DELETE /admin/users/1
|
|
74
|
+
# DELETE /admin/users/1.json
|
|
75
|
+
def destroy
|
|
76
|
+
@user = User.find(params[:id])
|
|
77
|
+
@user.destroy
|
|
78
|
+
|
|
79
|
+
respond_to do |format|
|
|
80
|
+
format.html { redirect_to users_url }
|
|
81
|
+
format.json { head :no_content }
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|