alter_admin 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/alter_admin.rb +5 -0
- data/lib/alter_admin/engine.rb +11 -0
- data/lib/alter_admin/version.rb +3 -0
- data/lib/generators/alter_admin.rb +13 -0
- data/lib/generators/alter_admin/install/install_generator.rb +38 -0
- data/lib/generators/alter_admin/install/templates/admin.html.erb +53 -0
- data/lib/generators/alter_admin/install/templates/alter_admin_settings.rb +29 -0
- data/lib/generators/alter_admin/install/templates/alter_admin_simple_form.rb +80 -0
- data/lib/generators/alter_admin/install/templates/home_controller.rb +20 -0
- data/lib/generators/alter_admin/install/templates/home_index.html.erb +26 -0
- data/lib/generators/alter_admin/resource/resource_generator.rb +31 -0
- data/lib/generators/alter_admin/resource/templates/controller.rb +11 -0
- data/lib/generators/alter_admin/resource/templates/model_setting.rb +34 -0
- data/lib/generators/alter_admin/resource/templates/views/_form.html.erb +18 -0
- data/lib/generators/alter_admin/resource/templates/views/edit.html.erb +15 -0
- data/lib/generators/alter_admin/resource/templates/views/index.html.erb +42 -0
- data/lib/generators/alter_admin/resource/templates/views/new.html.erb +15 -0
- data/lib/generators/alter_admin/resource/templates/views/show.html.erb +23 -0
- data/vendor/assets/javascripts/admin/script.js +33 -0
- data/vendor/assets/stylesheets/admin/style.scss +31 -0
- metadata +234 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 769c9e6e8d9d3b47389df1c83a80c80b96081b21
|
4
|
+
data.tar.gz: 57979cd7f77dc10e547aef2e1b234c4ec2c361fe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e8a8b22a334e432efe80d77605701e44fef44d1504573c59627de58cfb4c5ab8ebc7b45338832cf9553fd3cee4a1ff256011008617d31684e88efa3d749c2c59
|
7
|
+
data.tar.gz: 127d82b67f15bb87c25c2baf31368e299a6bb8d2cabd6799ad6d82fdaf8d6f5abfba5ef3d9c03b42dc6880417c2f9cb070fe6ce2ce1915964b2e41de8ac21660
|
data/lib/alter_admin.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rails/generators/named_base'
|
2
|
+
|
3
|
+
module AlterAdmin
|
4
|
+
module Generators
|
5
|
+
class Base < ::Rails::Generators::NamedBase
|
6
|
+
|
7
|
+
def self.source_root
|
8
|
+
@_rspec_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'alter_admin', generator_name, 'templates'))
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module AlterAdmin
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
def create_alter_admin_settings
|
9
|
+
copy_file 'alter_admin_settings.rb', File.join('lib', "alter_admin_settings.rb")
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_layout
|
13
|
+
copy_file 'admin.html.erb', File.join('app/views/layouts', "admin.html.erb")
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_home_controller
|
17
|
+
copy_file 'home_controller.rb', File.join('app/controllers/admin', "home_controller.rb")
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_home_index_view
|
21
|
+
copy_file 'home_index.html.erb', File.join('app/views/admin/home', "home_index.html.erb")
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_route
|
25
|
+
route <<-ROUTE
|
26
|
+
namespace :admin do
|
27
|
+
root to: 'home#index', as: :panel
|
28
|
+
end
|
29
|
+
ROUTE
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_simple_form_initializer
|
33
|
+
copy_file 'alter_admin_simple_form.rb', File.join('config/initializers', "alter_admin_simple_form.rb")
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%= AlterAdminSettings.app_name %> - Панель Администрирования</title>
|
5
|
+
<%= stylesheet_link_tag "admin/style", media: "all" %>
|
6
|
+
<%= javascript_include_tag "admin/script" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<nav class="navbar navbar-inverse" role="navigation">
|
11
|
+
<div class="navbar-header">
|
12
|
+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
|
13
|
+
<span class="sr-only">Toggle navigation</span>
|
14
|
+
<span class="icon-bar"></span>
|
15
|
+
<span class="icon-bar"></span>
|
16
|
+
<span class="icon-bar"></span>
|
17
|
+
</button>
|
18
|
+
<a class="navbar-brand" href="/"><%= AlterAdminSettings.app_name %></a>
|
19
|
+
</div>
|
20
|
+
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
21
|
+
<ul class="nav navbar-nav">
|
22
|
+
<li><a href="/admin">Панель администрирования</a></li>
|
23
|
+
<li class="dropdown">
|
24
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Разделы <b class="caret"></b></a>
|
25
|
+
<ul class="dropdown-menu">
|
26
|
+
<% AlterAdminSettings.registered_models.each do |model| %>
|
27
|
+
<li><a href="<%= send("admin_#{model.name.underscore.pluralize}_path") %>"><%= model.model_name.human %></a></li>
|
28
|
+
<% end %>
|
29
|
+
</ul>
|
30
|
+
</li>
|
31
|
+
</ul>
|
32
|
+
<ul class="nav navbar-nav navbar-right">
|
33
|
+
<li class="dropdown">
|
34
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= current_user.full_name %><b class="caret"></b></a>
|
35
|
+
<ul class="dropdown-menu">
|
36
|
+
<li><a href="<%= destroy_session_path %>" data-method="delete">Выход</a></li>
|
37
|
+
</ul>
|
38
|
+
</li>
|
39
|
+
</ul>
|
40
|
+
</div>
|
41
|
+
</nav>
|
42
|
+
<div class="container" id="wrapper">
|
43
|
+
<%- flash.each do |type, msg| %>
|
44
|
+
<div class='bs-callout bs-callout-<%= flash_type_convert(type) %>'>
|
45
|
+
<div><%= msg %></div>
|
46
|
+
</div>
|
47
|
+
<%- end %>
|
48
|
+
|
49
|
+
<%= yield %>
|
50
|
+
<div class="footer-guarantor"></div>
|
51
|
+
</div>
|
52
|
+
</body>
|
53
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
class AlterAdminSettings
|
5
|
+
|
6
|
+
def self.app_name
|
7
|
+
"Application name"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.registered_models
|
11
|
+
fetch_models_names
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def self.fetch_models_names
|
17
|
+
root = get_settings_root
|
18
|
+
Dir["#{root}/*.rb"].map { |file| fetch_class(file) }
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.get_settings_root
|
22
|
+
File.expand_path("../app/admin", File.dirname(__FILE__))
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.fetch_class(file)
|
26
|
+
Pathname.new(file).basename.to_s.gsub('_admin_setting.rb', '').classify.constantize
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
inputs = %w[
|
3
|
+
CollectionSelectInput
|
4
|
+
DateTimeInput
|
5
|
+
FileInput
|
6
|
+
GroupedCollectionSelectInput
|
7
|
+
NumericInput
|
8
|
+
PasswordInput
|
9
|
+
RangeInput
|
10
|
+
StringInput
|
11
|
+
TextInput
|
12
|
+
]
|
13
|
+
|
14
|
+
inputs.each do |input_type|
|
15
|
+
superclass = "SimpleForm::Inputs::#{input_type}".constantize
|
16
|
+
|
17
|
+
new_class = Class.new(superclass) do
|
18
|
+
def input_html_classes
|
19
|
+
super.push('form-control')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Object.const_set(input_type, new_class)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Use this setup block to configure all options available in SimpleForm.
|
27
|
+
SimpleForm.setup do |config|
|
28
|
+
config.boolean_style = :nested
|
29
|
+
|
30
|
+
config.wrappers :alter_admin_bootstrap3, tag: 'div', class: 'form-group', error_class: 'has-error',
|
31
|
+
defaults: { input_html: { class: 'default_class' } } do |b|
|
32
|
+
|
33
|
+
b.use :html5
|
34
|
+
b.use :min_max
|
35
|
+
b.use :maxlength
|
36
|
+
b.use :placeholder
|
37
|
+
|
38
|
+
b.optional :pattern
|
39
|
+
b.optional :readonly
|
40
|
+
|
41
|
+
b.use :label, wrap_with: { tag: 'span', class: 'control-label col-md-2' }
|
42
|
+
b.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
43
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block has-error' }
|
44
|
+
b.wrapper tag: 'div', class: 'col-md-10' do |input|
|
45
|
+
input.use :input, class: 'form-control'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
config.wrappers :prepend, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
50
|
+
b.use :html5
|
51
|
+
b.use :placeholder
|
52
|
+
b.use :label
|
53
|
+
b.wrapper tag: 'div', class: 'controls' do |input|
|
54
|
+
input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
|
55
|
+
prepend.use :input
|
56
|
+
end
|
57
|
+
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
58
|
+
input.use :error, wrap_with: { tag: 'span', class: 'help-block has-error' }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
config.wrappers :append, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
63
|
+
b.use :html5
|
64
|
+
b.use :placeholder
|
65
|
+
b.use :label
|
66
|
+
b.wrapper tag: 'div', class: 'controls' do |input|
|
67
|
+
input.wrapper tag: 'div', class: 'input-append' do |append|
|
68
|
+
append.use :input
|
69
|
+
end
|
70
|
+
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
71
|
+
input.use :error, wrap_with: { tag: 'span', class: 'help-block has-error' }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
76
|
+
# Check the Bootstrap docs (http://getbootstrap.com/)
|
77
|
+
# to learn about the different styles for forms and inputs,
|
78
|
+
# buttons and other elements.
|
79
|
+
# config.default_wrapper = :bootstrap3
|
80
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Admin::HomeController < ActionController::Base
|
3
|
+
layout "admin"
|
4
|
+
|
5
|
+
before_action :authorize_admin
|
6
|
+
|
7
|
+
helper_method :current_user
|
8
|
+
|
9
|
+
def index; end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def current_user
|
14
|
+
@current_user ||= User.find(session[:user_id])
|
15
|
+
end
|
16
|
+
|
17
|
+
def authorize_admin
|
18
|
+
redirect_to root_path, alert: "Вы не имеете прав для доступа к этой странице!" if cannot?(:access, :alter_admin)
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h1>Информация</h1>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<table class="datatable">
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Модель</th>
|
9
|
+
<th>Количество</th>
|
10
|
+
<th>Операции</th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
<tbody>
|
14
|
+
<% AlterAdminSettings.registered_models.each do |model| %>
|
15
|
+
<tr>
|
16
|
+
<td><%= model.model_name.human %></td>
|
17
|
+
<td><%= model.count %></td>
|
18
|
+
<td>
|
19
|
+
<%= link_to send("admin_#{model.name.underscore.pluralize}_path") do %>
|
20
|
+
<%= fa_icon 'share-square-o 2x' %>
|
21
|
+
<% end %>
|
22
|
+
</td>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
</tbody>
|
26
|
+
</table>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'generators/alter_admin'
|
2
|
+
|
3
|
+
module AlterAdmin
|
4
|
+
module Generators
|
5
|
+
class ResourceGenerator < Base
|
6
|
+
|
7
|
+
def create_controller
|
8
|
+
template "controller.rb", File.join('app/controllers/admin', "#{file_name.pluralize}_controller.rb")
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_route
|
12
|
+
route <<-ROUTE
|
13
|
+
namespace :admin do
|
14
|
+
resources :#{plural_name}
|
15
|
+
end
|
16
|
+
ROUTE
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_views
|
20
|
+
%w{index edit new _form show}.each do |view|
|
21
|
+
template "views/#{view}.html.erb", File.join('app/views/admin', "#{file_name.pluralize}/#{view}.html.erb")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_model_admin_setting
|
26
|
+
template "model_setting.rb", File.join('app/admin', "#{file_name}_admin_setting.rb")
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Admin::<%= class_name.pluralize %>Controller < Admin::HomeController
|
3
|
+
inherit_resources
|
4
|
+
defaults route_prefix: 'admin', resource_class: <%= class_name %>, collection_name: '<%= plural_name %>', instance_name: '<%= plural_name.singularize %>'
|
5
|
+
|
6
|
+
private
|
7
|
+
def permitted_params
|
8
|
+
{<%= plural_name.singularize %>: params.fetch(:<%= plural_name.singularize %>, {}).permit!}
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class <%= class_name %>AdminSetting
|
3
|
+
|
4
|
+
def self.model_class
|
5
|
+
<%= class_name %>
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.table_columns
|
9
|
+
default_columns
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.show_columns
|
13
|
+
default_columns
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.edit_columns
|
17
|
+
default_columns
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.scopes
|
21
|
+
[]
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def self.default_columns
|
27
|
+
model_class.columns.inject({}) { |hash, c| hash[c.name.to_sym] = {as: c.type }; hash; }.except(*hidden_columns)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.hidden_columns
|
31
|
+
[:created_at, :updated_at]
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% model_class = class_name.constantize %>
|
2
|
+
|
3
|
+
<%= "
|
4
|
+
<% #{model_class.name}AdminSetting.edit_columns.each do |name, info| %\>
|
5
|
+
<%= f.input name, info %\>
|
6
|
+
<% if (info[:as] == :file) && !f.object.new_record? %\>
|
7
|
+
<% url = f.object.send(name) %\>
|
8
|
+
<div class='preview-image col-md-offset-2'>
|
9
|
+
<%= image_tag(url) %\>
|
10
|
+
</div>
|
11
|
+
<% end %\>
|
12
|
+
<% end %\>
|
13
|
+
<div class='row'>
|
14
|
+
<div class='col-md-8 col-md-offset-4'>
|
15
|
+
<%= f.button :submit, class: 'btn btn-info' %\>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
"%>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% model_class = class_name.constantize %>
|
2
|
+
<div class="page-header">
|
3
|
+
<h1 class="pull-left">Редактирование <%= "<%= #{model_class}.model_name.human %\>" %>#<%= "<%= resource.id %\>" %></h1>
|
4
|
+
<div class="pull-right">
|
5
|
+
<%= "<%= link_to 'Отмена', admin_#{plural_name}_path, class: 'btn btn-danger' %\>" %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<%= "<%= error_messages_for resource %\>" %>
|
10
|
+
|
11
|
+
<%= "
|
12
|
+
<%= simple_form_for resource, url: admin_#{plural_name.singularize}_path(resource), wrapper: :alter_admin_bootstrap3 do |f|%\>
|
13
|
+
<%= render 'form', f: f %\>
|
14
|
+
<% end %\>
|
15
|
+
" %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<% model_class = class_name.constantize %>
|
2
|
+
<div class="page-header">
|
3
|
+
<h1 class="pull-left"><%= "<%= #{model_class}.model_name.human %\>" %></h1>
|
4
|
+
<div class="pull-right">
|
5
|
+
<%= "<%= link_to 'Создать', new_admin_#{plural_name.singularize}_path, class: 'btn btn-default' %\>" %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<table class="datatable">
|
10
|
+
<thead>
|
11
|
+
<tr>
|
12
|
+
<%= "
|
13
|
+
<% #{model_class.name}AdminSetting.table_columns.each do |name, info| %\>
|
14
|
+
<th><%= #{model_class.name}.human_attribute_name(name)%\></th>
|
15
|
+
<% end %\>
|
16
|
+
"%>
|
17
|
+
<th>Операции</th>
|
18
|
+
</tr>
|
19
|
+
</thead>
|
20
|
+
<tbody>
|
21
|
+
<%= "
|
22
|
+
<% #{model_class.name}.find_each do |model| %\>
|
23
|
+
<tr>
|
24
|
+
<% #{model_class.name}AdminSetting.table_columns.each do |name, info| %\>
|
25
|
+
<td><%= model.send(name) %\></td>
|
26
|
+
<% end %\>
|
27
|
+
<td>
|
28
|
+
<%= link_to admin_#{plural_name.singularize}_path(model) do%\>
|
29
|
+
<%= fa_icon 'eye' %\>
|
30
|
+
<% end %\>
|
31
|
+
<%= link_to edit_admin_#{plural_name.singularize}_path(model) do%\>
|
32
|
+
<%= fa_icon 'edit' %\>
|
33
|
+
<% end %\>
|
34
|
+
<%= link_to admin_#{plural_name.singularize}_path(model), method: :delete, confirm: 'Вы уверены?' do%\>
|
35
|
+
<%= fa_icon 'trash-o' %\>
|
36
|
+
<% end %\>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<% end %\>
|
40
|
+
" %>
|
41
|
+
</tbody>
|
42
|
+
</table>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% model_class = class_name.constantize %>
|
2
|
+
<div class="page-header">
|
3
|
+
<h1 class="pull-left">Новый <%= "<%= #{model_class}.model_name.human %\>" %></h1>
|
4
|
+
<div class="pull-right">
|
5
|
+
<%= "<%= link_to 'Отмена', admin_#{plural_name}_path, class: 'btn btn-danger' %\>" %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<%= "<%= error_messages_for resource %\>" %>
|
10
|
+
|
11
|
+
<%= "
|
12
|
+
<%= simple_form_for resource, url: admin_#{plural_name}_path, wrapper: :alter_admin_bootstrap3 do |f|%\>
|
13
|
+
<%= render 'form', f: f %\>
|
14
|
+
<% end %\>
|
15
|
+
" %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% model_class = class_name.constantize %>
|
2
|
+
<div class="page-header">
|
3
|
+
<h1 class="pull-left"><%= "<%= #{model_class}.model_name.human %\>" %>#<%= "<%= resource.id %\>" %></h1>
|
4
|
+
<div class="pull-right">
|
5
|
+
<%= "<%= link_to 'Назад', admin_#{plural_name}_path, class: 'btn btn-default' %\>" %>
|
6
|
+
</div>
|
7
|
+
<div class="pull-right">
|
8
|
+
<%= "<%= link_to 'Редактировать', edit_admin_#{plural_name.singularize}_path(resource), class: 'btn btn-info' %\>" %>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<table class="table table-bordered">
|
13
|
+
<tbody>
|
14
|
+
<%= "
|
15
|
+
<% #{model_class.name}AdminSetting.show_columns.each do |name, info| %\>
|
16
|
+
<tr>
|
17
|
+
<td><%= #{model_class.name}.human_attribute_name(name) %\></td>
|
18
|
+
<td><%= resource.send(name) %\></td>
|
19
|
+
</tr>
|
20
|
+
<% end %\>
|
21
|
+
"%>
|
22
|
+
</tbody>
|
23
|
+
</table>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery_ujs
|
3
|
+
//= require twitter/bootstrap
|
4
|
+
//= require bootstrap
|
5
|
+
//= require dataTables/jquery.dataTables
|
6
|
+
//= require dataTables/jquery.dataTables.bootstrap3
|
7
|
+
|
8
|
+
$(document).ready(function(){
|
9
|
+
$('.datatable').dataTable({
|
10
|
+
"sPaginationType": "bootstrap",
|
11
|
+
"oLanguage":{
|
12
|
+
"sProcessing": "Подождите...",
|
13
|
+
"sLengthMenu": "Показать _MENU_ записей",
|
14
|
+
"sZeroRecords": "Записи отсутствуют.",
|
15
|
+
"sInfo": "Записи с _START_ до _END_ из _TOTAL_ записей",
|
16
|
+
"sInfoEmpty": "Записи с 0 до 0 из 0 записей",
|
17
|
+
"sInfoFiltered": "(отфильтровано из _MAX_ записей)",
|
18
|
+
"sInfoPostFix": "",
|
19
|
+
"sSearch": "Поиск:",
|
20
|
+
"sUrl": "",
|
21
|
+
"oPaginate": {
|
22
|
+
"sFirst": "Первая",
|
23
|
+
"sPrevious": "Предыдущая",
|
24
|
+
"sNext": "Следующая",
|
25
|
+
"sLast": "Последняя"
|
26
|
+
},
|
27
|
+
"oAria": {
|
28
|
+
"sSortAscending": ": активировать для сортировки столбца по возрастанию",
|
29
|
+
"sSortDescending": ": активировать для сортировки столбцов по убыванию"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
});
|
33
|
+
});
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/*
|
2
|
+
*= require bootstrap
|
3
|
+
*= require dataTables/jquery.dataTables
|
4
|
+
*= require dataTables/jquery.dataTables.bootstrap3
|
5
|
+
*= require dataTables/jquery.dataTables.bootstrap3
|
6
|
+
*= require font-awesome
|
7
|
+
*/
|
8
|
+
|
9
|
+
|
10
|
+
form{
|
11
|
+
.form-group{
|
12
|
+
display: inline-block;
|
13
|
+
width: 100%;
|
14
|
+
}
|
15
|
+
.preview-image{
|
16
|
+
img{
|
17
|
+
width: 200px;
|
18
|
+
height: 200px;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
.container{
|
24
|
+
width: 100% !important;
|
25
|
+
}
|
26
|
+
|
27
|
+
textarea{
|
28
|
+
&.h300{
|
29
|
+
height: 300px;
|
30
|
+
}
|
31
|
+
}
|
metadata
ADDED
@@ -0,0 +1,234 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alter_admin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- sergio1990
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: inherited_resources
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: has_scope
|
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'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simple_form
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jquery-datatables-rails
|
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
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jquery-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'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: twitter-bootstrap-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sprockets-rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: activesupport
|
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'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: cancan
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: bundler
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.3'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.3'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rake
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: sass-rails
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
description: Simple admin panel generator with inherited resources, has_scope, datatables
|
182
|
+
for Rails 4
|
183
|
+
email:
|
184
|
+
- sergeg1990@gmail.com
|
185
|
+
executables: []
|
186
|
+
extensions: []
|
187
|
+
extra_rdoc_files: []
|
188
|
+
files:
|
189
|
+
- lib/alter_admin/engine.rb
|
190
|
+
- lib/alter_admin/version.rb
|
191
|
+
- lib/alter_admin.rb
|
192
|
+
- lib/generators/alter_admin/install/install_generator.rb
|
193
|
+
- lib/generators/alter_admin/install/templates/admin.html.erb
|
194
|
+
- lib/generators/alter_admin/install/templates/alter_admin_settings.rb
|
195
|
+
- lib/generators/alter_admin/install/templates/alter_admin_simple_form.rb
|
196
|
+
- lib/generators/alter_admin/install/templates/home_controller.rb
|
197
|
+
- lib/generators/alter_admin/install/templates/home_index.html.erb
|
198
|
+
- lib/generators/alter_admin/resource/resource_generator.rb
|
199
|
+
- lib/generators/alter_admin/resource/templates/controller.rb
|
200
|
+
- lib/generators/alter_admin/resource/templates/model_setting.rb
|
201
|
+
- lib/generators/alter_admin/resource/templates/views/_form.html.erb
|
202
|
+
- lib/generators/alter_admin/resource/templates/views/edit.html.erb
|
203
|
+
- lib/generators/alter_admin/resource/templates/views/index.html.erb
|
204
|
+
- lib/generators/alter_admin/resource/templates/views/new.html.erb
|
205
|
+
- lib/generators/alter_admin/resource/templates/views/show.html.erb
|
206
|
+
- lib/generators/alter_admin.rb
|
207
|
+
- vendor/assets/javascripts/admin/script.js
|
208
|
+
- vendor/assets/stylesheets/admin/style.scss
|
209
|
+
homepage: ''
|
210
|
+
licenses:
|
211
|
+
- MIT
|
212
|
+
metadata: {}
|
213
|
+
post_install_message:
|
214
|
+
rdoc_options: []
|
215
|
+
require_paths:
|
216
|
+
- lib
|
217
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
224
|
+
- - '>='
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: '0'
|
227
|
+
requirements: []
|
228
|
+
rubyforge_project:
|
229
|
+
rubygems_version: 2.1.11
|
230
|
+
signing_key:
|
231
|
+
specification_version: 4
|
232
|
+
summary: Simple admin panel generator with inherited resources, has_scope, datatables
|
233
|
+
for Rails 4
|
234
|
+
test_files: []
|