rails_admin_ui_index_cards 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a383f5429a9929934f91ed1d41a68ed893307e1c
4
+ data.tar.gz: 7e2218ee0fd7449f73add6c3bef7d3cd46ddfaad
5
+ SHA512:
6
+ metadata.gz: 83fc47e3014561bccf230c7e15ae06ebf48e7abce5304e9ece44c340f7881f670747536919e764113f180729ca011c915bd3c8e6d6dbe3718b60ad39a77c75ae
7
+ data.tar.gz: c603ac145e19e98bb29df0ac359684a6c3833e0a851835635aa89276f24fdad9cdaa7115eba4bce61db29e19ea5728ca15563e44aa82831049c2a08fa89b1f71
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Gabriele Tassoni
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # RailsAdminUiIndexCards
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'rails_admin_ui_index_cards'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install rails_admin_ui_index_cards
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'RailsAdminUiIndexCards'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ require 'bundler/gem_tasks'
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task default: :test
@@ -0,0 +1,17 @@
1
+ %div.panel.panel-success
2
+ %div.panel-heading
3
+ %ul.inline.list-inline.pull-right
4
+ = menu_for :member, @abstract_model, object, true
5
+ %h4.panel-title
6
+ = check_box_tag "bulk_ids[]", object.id, false
7
+ %a{:"data-toggle" => "collapse", href: "#object-id-#{object.id}"}
8
+ = (object.display_name rescue false || object.title rescue false || object.name rescue false || object.code rescue false)
9
+ %div{id: "object-id-#{object.id}", class: "panel-collapse collapse"}
10
+ %div.panel-body
11
+ - properties.map{ |property| property.bind(:object, object) }.each do |property|
12
+ - key = capitalize_first_letter(property.label)
13
+ - value = property.pretty_value
14
+ %p.card-text{class: "#{property.css_class} #{property.type_css_class}", title: strip_tags(value.to_s)}
15
+ %strong
16
+ = key + ":"
17
+ = value
@@ -0,0 +1,112 @@
1
+ :ruby
2
+ query = params[:query]
3
+ params = request.params.except(:authenticity_token, :action, :controller, :utf8, :bulk_export, :_pjax)
4
+ params.delete(:query) if params[:query].blank?
5
+ params.delete(:sort_reverse) unless params[:sort_reverse] == 'true'
6
+ sort_reverse = params[:sort_reverse]
7
+ sort = params[:sort]
8
+ params.delete(:sort) if params[:sort] == @model_config.list.sort_by.to_s
9
+ export_action = RailsAdmin::Config::Actions.find(:export, { controller: self.controller, abstract_model: @abstract_model })
10
+ export_action = nil unless export_action && authorized?(export_action.authorization_key, @abstract_model)
11
+ description = RailsAdmin.config(@abstract_model.model_name).description
12
+ properties = @model_config.list.with(controller: self.controller, view: self, object: @abstract_model.model.new).visible_fields
13
+
14
+ - content_for :contextual_tabs do
15
+ = bulk_menu
16
+
17
+ %style
18
+ - properties.select{ |p| p.column_width.present? }.each do |property|
19
+ = "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }"
20
+ = "#list td.#{property.css_class} { max-width: #{property.column_width}px; }"
21
+ #list
22
+ .well.well-sm
23
+ - if filterable_fields.present?
24
+ .dropdown.pull-right{style: "margin-left:0.5em"}
25
+ %button.btn.btn-primary.dropdown-toggle#dropdownFilters{type: "button", :"data-toggle" => "dropdown", :"aria-haspopup" => "true", :"aria-expanded" => "true"}
26
+ = t('admin.misc.add_filter')
27
+ %b.caret
28
+ %ul.dropdown-menu#filters{:"aria-labelledby" => "dropdownFilters"}
29
+ - filterable_fields.each do |field|
30
+ - field_options = case field.type
31
+ - when :enum
32
+ - options_for_select(field.with(object: @abstract_model.model.new).enum)
33
+ - else
34
+ - ''
35
+ %li
36
+ %a{href: '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-options" => field_options.html_safe, :"data-field-type" => field.type, :"data-field-value" => "", :"data-field-datetimepicker-format" => (field.try(:parser) && field.parser.to_momentjs)}= capitalize_first_letter(field.label)
37
+
38
+ .dropdown.pull-right{style: "margin-left:0.5em"}
39
+ %button.btn.btn-primary.dropdown-toggle#dropdownOrder{type: "button", :"data-toggle" => "dropdown", :"aria-haspopup" => "true", :"aria-expanded" => "true"}
40
+ = t('admin.misc.order_by')
41
+ %b.caret
42
+ %ul.dropdown-menu{:"aria-labelledby" => "dropdownOrder"}
43
+ - properties.each do |property|
44
+ - selected = (sort == property.name.to_s)
45
+ - if property.sortable
46
+ - sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {})
47
+ - sort_direction = (sort_reverse == 'true' ? "sort-alpha-asc" : "sort-alpha-desc" if selected)
48
+ %li
49
+ %a{href:"#", class: "#{property.sortable && "header pjax" || nil} #{sort_direction if property.sortable && sort_direction} #{property.css_class} #{property.type_css_class}", :'data-href' => (property.sortable && sort_location), rel: "tooltip", title: "#{property.hint}"}
50
+ %span{class: "fa fa-#{sort_direction}"}
51
+ = capitalize_first_letter(property.label)
52
+
53
+ - unless @model_config.list.scopes.empty?
54
+ .dropdown.pull-right{style: "margin-left:0.5em"}
55
+ %button.btn.btn-primary.dropdown-toggle#dropdownScopes{type: "button", :"data-toggle" => "dropdown", :"aria-haspopup" => "true", :"aria-expanded" => "true"}
56
+ = t('admin.misc.scopes')
57
+ %b.caret
58
+ %ul.dropdown-menu{:"aria-labelledby" => "dropdownScopes"}
59
+ - @model_config.list.scopes.each_with_index do |scope, index|
60
+ - scope = '_all' if scope.nil?
61
+ %li{class: "#{'active' if scope.to_s == params[:scope] || (params[:scope].blank? && index == 0)}"}
62
+ %a{href: index_path(params.merge(scope: scope, page: nil)), class: 'pjax'}= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize))
63
+
64
+ - if export_action
65
+ .pull-right{style: "margin-left:0.5em"}
66
+ %a.btn.btn-primary{href: export_path(params.except('set').except('page'))}
67
+ = t("admin.export.found")
68
+
69
+ -unless @objects.blank?
70
+ .pull-right{style: "margin-left:0.5em"}
71
+ %a.btn.btn-primary#select-all
72
+ = t("admin.select.toggle")
73
+
74
+ = form_tag(index_path(params.except(*%w[page f query])), method: :get, class: "pjax-form form-inline") do
75
+ .input-group
76
+ %input.form-control.input-small{name: "query", type: "search", value: query, placeholder: t("admin.misc.filter")}
77
+ %span.input-group-btn
78
+ %button.btn.btn-primary{type: 'submit', :'data-disable-with' => '<i class="icon-white icon-refresh"></i> '.html_safe + t('admin.misc.refresh')}
79
+ %i.icon-white.icon-refresh
80
+ = t('admin.misc.refresh')
81
+ %button#remove_filter.btn.btn-info{title: "Reset filters"}
82
+ %i.icon-white.icon-remove
83
+ %hr.filters_box{style: "display:#{ordered_filters.empty? ? 'none' : 'block'}"}
84
+ %span#filters_box
85
+
86
+ = form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: "form" do
87
+ = hidden_field_tag :bulk_action
88
+ - if description.present?
89
+ %p
90
+ %strong= description
91
+
92
+ - @objects.each do |object|
93
+ = render partial: "card", locals: {object: object, properties: properties, sort: sort, sort_reverse: sort_reverse}
94
+
95
+ - if @objects.respond_to?(:total_count)
96
+ - total_count = @objects.total_count.to_i
97
+ .row
98
+ .col-md-6= paginate(@objects, theme: 'ra-twitter-bootstrap', remote: true)
99
+ .row
100
+ .col-md-6= link_to(t("admin.misc.show_all"), index_path(params.merge(all: true)), class: "show-all btn btn-default clearfix pjax") unless total_count > 100 || total_count <= @objects.to_a.size
101
+ .clearfix.total-count= "#{total_count} #{@model_config.pluralize(total_count).downcase}"
102
+ - else
103
+ .clearfix.total-count= "#{@objects.size} #{@model_config.pluralize(@objects.size).downcase}"
104
+
105
+ :javascript
106
+ jQuery(function($) {
107
+ #{ordered_filter_string}
108
+ });
109
+ $("#select-all").click(_ => $("input[name='bulk_ids[]']").each((index, chkBox) => {
110
+ console.log(chkBox);
111
+ $(chkBox).prop('checked', !$(chkBox).is(':checked'));
112
+ }));
@@ -0,0 +1,8 @@
1
+ en:
2
+ admin:
3
+ export:
4
+ found: Export found
5
+ misc:
6
+ order_by: Order by
7
+ select:
8
+ toggle: Toggle Selection
@@ -0,0 +1,8 @@
1
+ it:
2
+ admin:
3
+ export:
4
+ found: Esporta trovati
5
+ misc:
6
+ order_by: Ordina per
7
+ select:
8
+ toggle: Inverti Selezione
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -0,0 +1,5 @@
1
+ require "rails_admin_ui_index_cards/engine"
2
+
3
+ module RailsAdminUiIndexCards
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,4 @@
1
+ module RailsAdminUiIndexCards
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module RailsAdminUiIndexCards
2
+ VERSION = '1.1.2'
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :rails_admin_ui_index_cards do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_admin_ui_index_cards
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Gabriele Tassoni
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thecore
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ description: Add the cards view for lists.
28
+ email:
29
+ - gabrieletassoni@taris.it
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - app/assets/config/rails_admin_ui_index_cards_manifest.js
38
+ - app/views/rails_admin/main/_card.html.haml
39
+ - app/views/rails_admin/main/index.html.haml
40
+ - config/locales/en.index_cards.custom.yml
41
+ - config/locales/it.index_cards.custom.yml
42
+ - config/routes.rb
43
+ - lib/rails_admin_ui_index_cards.rb
44
+ - lib/rails_admin_ui_index_cards/engine.rb
45
+ - lib/rails_admin_ui_index_cards/version.rb
46
+ - lib/tasks/rails_admin_ui_index_cards_tasks.rake
47
+ homepage: https://www.taris.it
48
+ licenses:
49
+ - MIT
50
+ metadata: {}
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 2.6.14
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Thecorized RailsAdminUiIndexCards.
71
+ test_files: []