the_role_bootstrap3_ui 1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2247e8f683d3b6c2fec1f99782e34c6a7efcfc6
4
+ data.tar.gz: d451a5bc4d68e6a49027506db80c2ca45c2fc228
5
+ SHA512:
6
+ metadata.gz: e890d2c9052a08084574f2324d48bb26a59c4345a5c9245d0c4b8d3110169958e270c85bf5b240eb9a9313c908736e63491a2460d9ff9b0c745c861b530c8932
7
+ data.tar.gz: f1392c7b8179f13065908d2b37121e47d28e8582a8a79b4b0112dd0fd639ec629441073c9f0b77179a61b8a19d46073a771c39af1ab1605030cb5bad00fc6593
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in the_role_bootstrap3_ui.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ilya N. Zykin
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ ## TheRoleBootstrap3Ui
2
+
3
+ Admin UI for gem TheRole
4
+
5
+ Version based on Bootstrap3
6
+
7
+ ### GUI
8
+
9
+ <table>
10
+ <tr>
11
+ <td>TheRole management web interface => localhost:3000/admin/roles</td>
12
+ </tr>
13
+ <tr>
14
+ <td><img src="https://github.com/the-teacher/the_role/raw/master/pic.png" alt="TheRole"></td>
15
+ </tr>
16
+ </table>
17
+
18
+ ## Installation
19
+
20
+ Gemfile
21
+
22
+ ```ruby
23
+ gem 'the_role_bootstrap3_ui'
24
+ ```
25
+
26
+ And then execute:
27
+
28
+ ```sh
29
+ $ bundle
30
+ ```
31
+
32
+ Or install it yourself as:
33
+
34
+ ```sh
35
+ $ gem install the_role_bootstrap3_ui
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ### Assets and Bootstrap
41
+
42
+ **application.css**
43
+
44
+ ```
45
+ //= require bootstrap
46
+ ```
47
+
48
+ **application.js**
49
+
50
+ ```
51
+ //= require jquery
52
+ //= require jquery_ujs
53
+
54
+ //= require bootstrap
55
+ //= require the_role_editinplace
56
+ ```
57
+
58
+ ## MIT
59
+
60
+ zykin-ilya@ya.ru
61
+
62
+ 2014
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
File without changes
@@ -0,0 +1,32 @@
1
+ showForm = (item) ->
2
+ holder = item.parents('.holder')
3
+ a_item = holder.children('span.a')
4
+ b_item = holder.children('span.b')
5
+
6
+ a_item.hide().off 'click'
7
+ b_item.css('visibility', 'visible')
8
+
9
+ holder.find('.btn-warning').click ->
10
+ item = $ @
11
+ hideForm item
12
+ item.parents('form')[0].reset()
13
+
14
+ holder.find('.btn-success').click ->
15
+ $(@).parents('form')[0].submit()
16
+
17
+ b_item.find('input').keypress (event) ->
18
+ ENTER = 13
19
+ form = $(event.target).parents('form')
20
+ form.submit() if event.which is ENTER
21
+
22
+ hideForm = (item) ->
23
+ holder = item.parents('.holder')
24
+ a_item = holder.children('span.a')
25
+ b_item = holder.children('span.b')
26
+
27
+ a_item.show()
28
+ b_item.css('visibility', 'hidden')
29
+ holder.find('.btn').off('click')
30
+ a_item.click -> showForm item
31
+
32
+ $ -> $('span.a', 'h3, h5').click -> showForm $(@)
@@ -0,0 +1,97 @@
1
+ - content_for :role_update_btn_set do
2
+ .btn-group
3
+ %a.btn.btn-warning
4
+ %i.icon-repeat.glyphicon.glyphicon-repeat
5
+ %a.btn.btn-success
6
+ %i.icon-ok.glyphicon.glyphicon-ok
7
+
8
+ - content_for :role_main do
9
+ - hidden = 'visibility:hidden'
10
+ .panel.panel-primary
11
+ .panel-heading Role Info (edit in place)
12
+ .panel-body
13
+ = form_for(role, url: change_admin_role_path(role), html: { class: "form-inline" } ) do |f|
14
+ .row
15
+ .col-md-12
16
+ %h3.holder
17
+ = t '.role_name'
18
+ %span.a= role.name
19
+ %span.b{ style: hidden }
20
+ .form-group= f.text_field :name, class: "form-control"
21
+ = yield(:role_update_btn_set)
22
+
23
+ .row
24
+ .col-md-12
25
+ %h5.holder
26
+ = t '.title'
27
+ %span.a= role.title
28
+ %span.b{ style: hidden }
29
+ .form-group= f.text_field :title, class: "form-control"
30
+ = yield(:role_update_btn_set)
31
+
32
+ .row
33
+ .col-md-12
34
+ %h5.holder
35
+ = t '.role_description'
36
+ %span.a= role.description
37
+ %span.b{ style: hidden }
38
+ .form-group= f.text_field :description, class: "form-control"
39
+ = yield(:role_update_btn_set)
40
+
41
+ .panel.panel-primary
42
+ .panel-heading Role rules
43
+ .panel-body
44
+ - role.to_hash.each_pair do |section, rules|
45
+ .panel.panel-info
46
+ .panel-heading
47
+ .row
48
+ .col-md-9
49
+ %h5= section
50
+ .col-md-3
51
+ .delete
52
+ .btn-group
53
+ = button_to t('.delete_section'), admin_role_section_path(role, section), method: :delete, class: 'btn btn-danger', data: { confirm: t('.section_delete_confirm') }
54
+
55
+ .panel-body
56
+ .rules
57
+ - rules.each_pair do |rule, value|
58
+ .row
59
+ .col-md-9
60
+ %h4
61
+ &rarr;
62
+ = rule
63
+ .col-md-3
64
+ .controls
65
+ .btn-group
66
+ - klass = value ? :success : :info
67
+ - state = value ? t('.enable') : t('.disable')
68
+ %button{ class: "btn btn-#{klass}" }= state
69
+ %button{ class: "btn btn-#{klass} dropdown-toggle", 'data-toggle' => :dropdown }
70
+ %span.caret
71
+ %ul.dropdown-menu
72
+ %li.success= link_to t('.enable'), rule_on_admin_role_section_path(role, section, :name => rule), :method => :put
73
+ %li.info= link_to t('.disable'), rule_off_admin_role_section_path(role, section, :name => rule), :method => :put
74
+ %li.divider
75
+ %li.error= link_to t('.delete_rule'), destroy_rule_admin_role_section_path(role, section, :name => rule), method: :delete, data: { confirm: t(".rule_delete_confirm") }
76
+
77
+ .panel.panel-success
78
+ .panel-heading
79
+ = t '.create_section'
80
+ .panel-body
81
+ = form_tag admin_role_sections_path(role), class: "form-inline"do |f|
82
+ .form-group
83
+ = text_field_tag :section_name, '', class: "form-control", placeholder: t('.new_section_placeholder')
84
+ = submit_tag t('.create_section'), class: "btn btn-success"
85
+
86
+ .panel.panel-success
87
+ .panel-heading
88
+ = t '.create_rule'
89
+ .panel-body
90
+ = form_tag create_rule_admin_role_sections_path(role), role: :form, class: "form-inline" do |f|
91
+ .form-group
92
+ %select.form-control{ name: :section_name }
93
+ - role.to_hash.each_pair do |section, rules|
94
+ %option{ value: section }= section
95
+ .form-group
96
+ = text_field_tag :rule_name, '', class: "form-control", placeholder: t('.new_rule_placeholder')
97
+ = submit_tag t('.create_rule'), class: "btn btn-success"
@@ -0,0 +1,18 @@
1
+ - content_for :role_sidebar do
2
+ .panel.panel-primary
3
+ .panel-heading Role Nav
4
+ .panel-body
5
+ %h4= link_to raw('&larr; Home'), root_path
6
+
7
+ .panel.panel-primary
8
+ .panel-heading= t '.roles_list'
9
+ .panel-body
10
+
11
+ - (@roles || Role.all).each do |role|
12
+ %p
13
+ = link_to role.title, edit_admin_role_url(role)
14
+ (#{role.users.count})
15
+ = link_to admin_role_url(role), method: :delete, title: role.title, confirm: t('.delete_role_confirm'), class: :delete do
16
+ %i.icon-remove.glyphicon.glyphicon-remove
17
+
18
+ %p.new= link_to t('.new_role'), new_admin_role_path
@@ -0,0 +1,2 @@
1
+ = render partial: 'sidebar'
2
+ = render partial: 'role', locals: { role: @role }
@@ -0,0 +1,2 @@
1
+ = render partial: 'sidebar'
2
+ = render partial: 'role', locals: { role: @roles.first }
@@ -0,0 +1,25 @@
1
+ = render partial: 'sidebar'
2
+
3
+ - content_for :role_main do
4
+ - unless @role.errors.blank?
5
+ - @role.errors.each do |field, message|
6
+ .alert.alert-danger
7
+ %b= t(".#{field}")
8
+ \:
9
+ = message
10
+
11
+ .panel.panel-success
12
+ .panel-heading= raw t('.create')
13
+
14
+ .panel-body
15
+ = form_for(@role, url: admin_roles_path, role: :form) do |f|
16
+ %label= t('.name')
17
+ %p= f.text_field :name, class: "form-control"
18
+
19
+ %label= t('.title')
20
+ %p= f.text_field :title, class: "form-control"
21
+
22
+ %label= t('.description')
23
+ %p= f.text_field :description, class: "form-control"
24
+
25
+ = f.submit t('.create'), class: "btn btn-success"
data/gem_version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module TheRoleBootstrap3Ui
2
+ VERSION = "1.0"
3
+ end
@@ -0,0 +1,6 @@
1
+ require 'haml'
2
+ require_relative "the_role_bootstrap3_ui/version"
3
+
4
+ module TheRoleBootstrap3Ui
5
+ class Engine < Rails::Engine; end
6
+ end
@@ -0,0 +1 @@
1
+ require_relative "../../gem_version"
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'the_role_bootstrap3_ui/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "the_role_bootstrap3_ui"
8
+ spec.version = TheRoleBootstrap3Ui::VERSION
9
+ spec.authors = ["Ilya N. Zykin"]
10
+ spec.email = ["zykin-ilya@ya.ru"]
11
+ spec.summary = %q{ Bootstrap3 views for TheRole }
12
+ spec.description = %q{ Bootstrap3 views for TheRole }
13
+ spec.homepage = "http://github.com/the-teacher"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency 'haml'
25
+
26
+ spec.add_runtime_dependency 'rails', ['>= 3', '< 5']
27
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: the_role_bootstrap3_ui
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Ilya N. Zykin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
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: haml
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: rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '3'
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: '5'
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '3'
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '5'
75
+ description: " Bootstrap3 views for TheRole "
76
+ email:
77
+ - zykin-ilya@ya.ru
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - ".gitignore"
83
+ - Gemfile
84
+ - LICENSE.txt
85
+ - README.md
86
+ - Rakefile
87
+ - app/assets/javascripts/.keep
88
+ - app/assets/javascripts/the_role_editinplace.js.coffee
89
+ - app/views/admin/roles/_role.html.haml
90
+ - app/views/admin/roles/_sidebar.html.haml
91
+ - app/views/admin/roles/edit.html.haml
92
+ - app/views/admin/roles/index.haml
93
+ - app/views/admin/roles/new.html.haml
94
+ - gem_version.rb
95
+ - lib/the_role_bootstrap3_ui.rb
96
+ - lib/the_role_bootstrap3_ui/version.rb
97
+ - the_role_bootstrap3_ui.gemspec
98
+ homepage: http://github.com/the-teacher
99
+ licenses:
100
+ - MIT
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.1.11
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Bootstrap3 views for TheRole
122
+ test_files: []