faalis 2.0.4 → 2.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91e71ae5053b9659996646106ecb2767da75ed1e
4
- data.tar.gz: 3267a632620a2c0f490cdbd75faf6ffc44d5c964
3
+ metadata.gz: 20d4b118e1da29b8834ccedee9cc1d1fb1190792
4
+ data.tar.gz: 5b528576a0774a70e3fa2b2e4b702a2e47b30abd
5
5
  SHA512:
6
- metadata.gz: 7ec5735dc4ba300c1f60ac405cd20e69b1b9966785042749e8b4edec1a75280af8006f104e68c7508e72c5bd626e2a2e58567d50affdb21093f4b6076c9cf0c7
7
- data.tar.gz: 2ec74c76341989469f11dcf3a50f13ff3d0e9a722d4874878ab3fa55ef120c1e49287e80193f24dece988950ee9965646d00a10f0529bae025f69adbedc9a825
6
+ metadata.gz: ab54e163b30605dfc66cc9d39a47f1f2b914d2c949d0caafc9a6002bb009a40fefa88be7f11c18a8efa078a1534367beead995aba796c47fb8f3a1703b7555a9
7
+ data.tar.gz: ccf0422c9f191f93ec9805e8ec35c56470a98587735a49baa08ad92a126b483f5fca5b055c44bc2d867281b3b1c1d9a54b13acdfcd6f5ba997d9e2df4250c707
@@ -1,4 +1,4 @@
1
- .row
1
+ .row.hidden-print
2
2
  .col-xs-12
3
3
  - if flash[:error]
4
4
  .alert.alert-danger.alert-dismissable
@@ -18,7 +18,7 @@
18
18
  .box-header.with-border
19
19
  h3.box-title
20
20
  |
21
- .box-tools
21
+ .box-tools.hidden-print
22
22
  - if policy(@resources.model).create?
23
23
  = link_button(t("faalis.dashboard.index_view.new_button", title: t("resources.#{@resources.model.name.underscore}")), remote: false, href: get_url(@new_route, nil, @engine), classes: 'btn-success', icon_class: 'plus')
24
24
 
@@ -32,7 +32,7 @@
32
32
  th
33
33
  /= field
34
34
  = t("main_app.#{field}").humanize
35
- th.text-center
35
+ th.text-center.hidden-print
36
36
  = t('faalis.actions')
37
37
 
38
38
  - @resources.each do |resource|
@@ -41,7 +41,7 @@
41
41
  - @index_fields.each do |field|
42
42
  td
43
43
  = resource.try(field.to_s).to_s || '-'
44
- td.btn-user.text-center
44
+ td.btn-user.text-center.hidden-print
45
45
  .btn-group
46
46
  a.pull-left.link.btn.btn-xs.btn-default href=(get_url(@show_route, resource.id, @engine))
47
47
  i.fa.fa-eye
@@ -53,7 +53,7 @@
53
53
  - @_tools_buttons.each do |btn_name, btn|
54
54
  a id=("tool_button_#{btn_name}") class=("link pull-left btn btn-xs #{btn[:class] || 'btn-default'}") href=(btn[:block].call(resource)) data-remote=("#{btn[:remote]}")
55
55
  i class=("fa #{btn[:icon_class]}")
56
- .box-footer
56
+ .box-footer.hidden-print
57
57
  .row
58
58
  .col-xs-12.col-sm-12
59
59
  = paginate @resources
@@ -14,7 +14,7 @@
14
14
  = @resource.send(name.to_sym).to_s || "-"
15
15
 
16
16
 
17
- .box-footer
17
+ .box-footer.hidden-print
18
18
  .row
19
19
 
20
20
  .col-sm-2.pull-right
@@ -1,4 +1,4 @@
1
- footer.main-footer
1
+ footer.main-footer.hidden-print
2
2
  .pull-right.hidden-xs
3
3
  b
4
4
  = "#{t('faalis.faalis_version')}: "
@@ -19,12 +19,13 @@
19
19
  </head>
20
20
  <body class="skin-blue sidebar-mini sidebar-collapse">
21
21
  <div class="wrapper">
22
- <%= render 'faalis/shared/header' %>
23
- <%= render 'faalis/shared/sidebar' %>
22
+ <%= render 'faalis/dashboard/shared/header' %>
23
+ <%= render 'faalis/dashboard/shared/sidebar' %>
24
24
 
25
25
  <!-- Content Wrapper. Contains page content -->
26
26
  <div class="content-wrapper">
27
- <%= render 'faalis/shared/content_header' %>
27
+ <%= render 'faalis/dashboard/shared/content_header' %>
28
+ <%= render 'faalis/dashboard/shared/toolbar' %>
28
29
 
29
30
  <!-- Main content -->
30
31
  <section class="content">
@@ -43,8 +44,8 @@
43
44
  <%= yield %>
44
45
  </section><!-- /.content -->
45
46
  </div>
46
- <%= render 'faalis/shared/footer' %>
47
- <%= render 'faalis/shared/control_sidebar' %>
47
+ <%= render 'faalis/dashboard/shared/footer' %>
48
+ <%= render 'faalis/dashboard/shared/control_sidebar' %>
48
49
  </div>
49
50
  </body>
50
51
  </html>
@@ -9,7 +9,7 @@ en:
9
9
 
10
10
  faalis_version: Faalis Version
11
11
  copyright_html: |
12
- &copy; 2013-2015 <a href="http://yellowen.com">Yellowen</a>.
12
+ &copy; 2013-2016 <a href="http://yellowen.com">Yellowen</a>.
13
13
 
14
14
  page_not_found: Oops! Page not found
15
15
  page_not_found_desc: We could not find the page you were looking for.
@@ -78,6 +78,8 @@ en:
78
78
  index_section:
79
79
  add_button: "New %{resource}"
80
80
 
81
+ buttons:
82
+ back: Back
81
83
 
82
84
  permissions:
83
85
  read: Read
@@ -49,6 +49,8 @@ fa:
49
49
  search: جستجو
50
50
  index_section:
51
51
  add_button: "%{resource} جدید"
52
+ buttons:
53
+ back: برگشت
52
54
  permissions:
53
55
  read: خواندن
54
56
  update: بروزرسانی
data/config/routes.rb CHANGED
@@ -30,6 +30,7 @@ Faalis::Engine.routes.draw do
30
30
  get '/404', to: '/faalis/dashboard#not_found', as: 'not_found'
31
31
  end
32
32
 
33
+ devise_config.merge!(Faalis::Engine.devise_for)
33
34
  devise_for :users, devise_config
34
35
  end
35
36
 
@@ -50,4 +50,7 @@ module Faalis::Configuration
50
50
  :lockable,
51
51
  :timeoutable,
52
52
  :validatable]
53
+
54
+ mattr_accessor :devise_for
55
+ @@devise_for = {}
53
56
  end
@@ -1,6 +1,6 @@
1
1
  require_dependency 'faalis/dashboard/dsl/base'
2
2
 
3
3
  module Faalis::Dashboard::DSL
4
- class Show < Base
4
+ class Show < Index
5
5
  end
6
6
  end
@@ -132,7 +132,7 @@ module Faalis::Dashboard::Sections
132
132
  end
133
133
  end
134
134
 
135
- def errorful_resopnse(section, msg = nil)
135
+ def errorful_resopnse(section, msg = nil, &block)
136
136
  @_msg = msg
137
137
 
138
138
  respond_to do |f|
@@ -141,11 +141,16 @@ module Faalis::Dashboard::Sections
141
141
  f.html { render :errors }
142
142
  else
143
143
  flash[:error] = msg
144
+
144
145
  path = Rails.application.routes.url_helpers.send(@index_route)
145
146
  # TODO: We really need to put setup routed on top of this method
146
147
 
147
148
  f.js { render 'faalis/shared/errors' }
148
- f.html { redirect_to path }
149
+ if block_given?
150
+ f.html(&block)
151
+ else
152
+ f.html { redirect_to path }
153
+ end
149
154
  end
150
155
  end
151
156
  end
@@ -59,7 +59,9 @@ module Faalis::Dashboard::Sections
59
59
  if @resource.save
60
60
  successful_response(:update)
61
61
  else
62
- errorful_resopnse(:update)
62
+ errorful_resopnse(:update, @resource.errors) do
63
+ redirect_to :edit
64
+ end
63
65
  end
64
66
  end
65
67
 
@@ -68,7 +70,6 @@ module Faalis::Dashboard::Sections
68
70
  authorize model
69
71
 
70
72
  @resource = model.new(creation_params)
71
-
72
73
  @resource.assign_attributes(**reflections_hash) unless reflections_hash.nil?
73
74
 
74
75
  # Customize the create behaviour
@@ -79,7 +80,9 @@ module Faalis::Dashboard::Sections
79
80
  if @resource.save
80
81
  successful_response(:create)
81
82
  else
82
- errorful_resopnse(:create)
83
+ errorful_resopnse(:create, @resource.errors) do
84
+ redirect_to Rails.application.routes.url_helpers.send(@new_route), turbolinks: true
85
+ end
83
86
  end
84
87
  end
85
88
 
@@ -95,10 +98,8 @@ module Faalis::Dashboard::Sections
95
98
  result = {}
96
99
 
97
100
  reflections.each do |name, column|
98
- has_many = ActiveRecord::Reflection::HasManyReflection
99
- has_and_belongs_to_many = ActiveRecord::Reflection::HasAndBelongsToManyReflection
101
+ unless is_reflection?(column)
100
102
 
101
- if !column.is_a?(has_many) && !column.is_a?(has_and_belongs_to_many)
102
103
  value = creation_params[column.foreign_key]
103
104
  result[column.foreign_key.to_sym] = value
104
105
  end
@@ -119,6 +120,16 @@ module Faalis::Dashboard::Sections
119
120
  params.require(resource).permit(*fields)
120
121
  end
121
122
 
123
+ # Check whether the given column is a reflection or not.
124
+ def is_reflection?(c)
125
+ has_many = ActiveRecord::Reflection::HasManyReflection
126
+ has_and_belongs_to_many = ActiveRecord::Reflection::HasAndBelongsToManyReflection
127
+ has_many_through = ActiveRecord::Reflection::ThroughReflection
128
+
129
+ result = c.is_a?(has_many) || c.is_a?(has_and_belongs_to_many)
130
+ result || c.is_a?(has_many_through)
131
+ end
132
+
122
133
  private
123
134
 
124
135
  # You can override this method to change the behaviour of `create`
@@ -18,5 +18,5 @@
18
18
  # -----------------------------------------------------------------------------
19
19
 
20
20
  module Faalis
21
- VERSION = '2.0.4'
21
+ VERSION = '2.0.5'
22
22
  end
@@ -3,13 +3,14 @@ namespace :faalis do
3
3
  desc 'Add all the missing keys to the locale files'
4
4
  task :collect do
5
5
  def merge_recursively(a, b)
6
- puts "Rec: ", a, b
6
+ #puts "Rec: ", a, b
7
7
  return b if a.is_a?(String)
8
8
  a.merge(b) {|key, a_item, b_item| merge_recursively(a_item, b_item) }
9
9
  end
10
10
 
11
11
  Dir["#{Rails.root}/tmp/i18n/*"].each do |locale_file|
12
12
  locale = locale_file.split('/')[-1]
13
+
13
14
  if File.exist? "#{Rails.root}/config/locales/#{locale}.yml"
14
15
  raw_data = File.read("#{Rails.root}/config/locales/#{locale}.yml")
15
16
  locale_data = YAML.load(raw_data)
@@ -19,7 +20,7 @@ namespace :faalis do
19
20
 
20
21
  Dir["#{Rails.root}/tmp/i18n/#{locale}/*"].each do |key_file|
21
22
  key = key_file.split('/')[-1]
22
- puts "Key", key
23
+ #puts "Key", key
23
24
 
24
25
  title = key.split('.')[-1].titleize
25
26
  array = ::I18n.normalize_keys(locale, key, nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faalis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sameer Rahmani
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-04 00:00:00.000000000 Z
12
+ date: 2016-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -640,6 +640,13 @@ files:
640
640
  - app/views/faalis/dashboard/resource/new.html.slim
641
641
  - app/views/faalis/dashboard/resource/show.html.slim
642
642
  - app/views/faalis/dashboard/resource/update.js.erb
643
+ - app/views/faalis/dashboard/shared/_content_header.html.slim
644
+ - app/views/faalis/dashboard/shared/_control_sidebar.html.slim
645
+ - app/views/faalis/dashboard/shared/_footer.html.slim
646
+ - app/views/faalis/dashboard/shared/_header.html.erb
647
+ - app/views/faalis/dashboard/shared/_sidebar.html.erb
648
+ - app/views/faalis/dashboard/shared/_toolbar.html.slim
649
+ - app/views/faalis/dashboard/shared/errors.js.erb
643
650
  - app/views/faalis/dashboard/users/_form.html.slim
644
651
  - app/views/faalis/dashboard/users/_password_form.html.slim
645
652
  - app/views/faalis/dashboard/users/create.js.erb
@@ -653,12 +660,6 @@ files:
653
660
  - app/views/faalis/dashboard/users/update.js.erb
654
661
  - app/views/faalis/dashboard/users/update_password.js.erb
655
662
  - app/views/faalis/relations/_belongs_to.json.jbuilder
656
- - app/views/faalis/shared/_content_header.html.slim
657
- - app/views/faalis/shared/_control_sidebar.html.slim
658
- - app/views/faalis/shared/_footer.html.slim
659
- - app/views/faalis/shared/_header.html.erb
660
- - app/views/faalis/shared/_sidebar.html.erb
661
- - app/views/faalis/shared/errors.js.erb
662
663
  - app/views/kaminari/_first_page.html.slim
663
664
  - app/views/kaminari/_gap.html.slim
664
665
  - app/views/kaminari/_last_page.html.slim