kuhsaft 0.2.1 → 0.2.2

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.
Files changed (33) hide show
  1. data/.gitignore +3 -1
  2. data/app/models/kuhsaft/asset.rb +5 -1
  3. data/app/stylesheets/kuhsaft/cms/partials/_buttons.sass +25 -4
  4. data/app/stylesheets/kuhsaft/cms/partials/_generic.sass +44 -28
  5. data/app/stylesheets/kuhsaft/cms/partials/_simple_form.sass +5 -4
  6. data/app/uploaders/kuhsaft/asset_uploader.rb +5 -2
  7. data/app/views/kuhsaft/cms/assets/_list.html.haml +1 -1
  8. data/app/views/kuhsaft/cms/pages/_branch.html.haml +1 -1
  9. data/app/views/kuhsaft/cms/pages/_form.html.haml +13 -9
  10. data/app/views/kuhsaft/cms/pages/index.html.haml +1 -1
  11. data/app/views/kuhsaft/page_part/markdowns/_edit_markdown.html.haml +1 -1
  12. data/app/views/layouts/kuhsaft/admin.html.haml +14 -8
  13. data/config/locales/kuhsaft.en.yml +3 -3
  14. data/kuhsaft.gemspec +1 -0
  15. data/lib/kuhsaft/version.rb +1 -1
  16. data/public/images/kuhsaft/closedhand.cur +0 -0
  17. data/public/images/kuhsaft/openhand.cur +0 -0
  18. data/public/images/kuhsaft/page-part-draggable-area.png +0 -0
  19. data/public/javascripts/kuhsaft/cms/application.js +5 -2
  20. data/public/javascripts/kuhsaft/cms/jquery.elastic.source.js +161 -0
  21. data/public/javascripts/kuhsaft/cms/jquery.min.js +18 -0
  22. data/public/javascripts/kuhsaft/cms/jquery_ujs.js +336 -0
  23. data/spec/models/asset_spec.rb +3 -3
  24. metadata +42 -40
  25. data/public/javascripts/kuhsaft/cms/jquery-1.4.4.js +0 -7179
  26. data/public/javascripts/kuhsaft/cms/rails.js +0 -157
  27. data/spec/dummy/public/javascripts/kuhsaft/admin/jquery-1.4.4.js +0 -7179
  28. data/spec/dummy/public/javascripts/kuhsaft/admin/jquery-ui-1.8.10.custom.min.js +0 -110
  29. data/spec/dummy/public/javascripts/kuhsaft/admin/rails.js +0 -157
  30. data/spec/dummy/public/javascripts/kuhsaft/cms/application.js +0 -31
  31. data/spec/dummy/public/javascripts/kuhsaft/cms/jquery-1.4.4.js +0 -7179
  32. data/spec/dummy/public/javascripts/kuhsaft/cms/jquery-ui-1.8.12.custom.min.js +0 -192
  33. data/spec/dummy/public/javascripts/kuhsaft/cms/rails.js +0 -157
data/.gitignore CHANGED
@@ -9,7 +9,9 @@ spec/dummy/db/schema.rb
9
9
  spec/dummy/public/stylesheets/*
10
10
  spec/dummy/public/uploads/tmp/*
11
11
  spec/dummy/public/uploads/kuhsaft/*
12
+ spec/dummy/public/uploads/*
13
+ spec/dummy/public/images/**/*
14
+ spec/dummy/public/javascripts/**/*
12
15
  Gemfile.lock
13
16
  .DS_Store
14
17
  .sass-cache
15
- spec/dummy/public/uploads/*
@@ -3,7 +3,7 @@ class Kuhsaft::Asset < ActiveRecord::Base
3
3
  mount_uploader :file, Kuhsaft::AssetUploader
4
4
 
5
5
  def file_type
6
- if file.url.present? && ext = file.url.split('.').last
6
+ if file.path.present? && ext = File.extname(file.path).split('.').last
7
7
  ext.to_sym unless ext.blank?
8
8
  end
9
9
  end
@@ -19,4 +19,8 @@ class Kuhsaft::Asset < ActiveRecord::Base
19
19
  def path=val
20
20
  # do nothing
21
21
  end
22
+
23
+ def filename
24
+ try(:file).try(:file).try(:filename)
25
+ end
22
26
  end
@@ -1,13 +1,34 @@
1
1
  .toolbar
2
- padding: 10px 0px
2
+ padding: 10px 25px
3
3
  background: #F8F8F8
4
4
 
5
- a.button
5
+ a.button,
6
+ a.small-button
6
7
  +float_right
7
8
 
8
- a.button
9
+ a.button,
10
+ a.small-button,
11
+ input.input-button,
12
+ input.small-input-button,
13
+ .micro-button
9
14
  background: $color1
10
15
  padding: 10px 15px
11
16
  margin-right: 10px
12
17
  +link-colors(#fff, #fff, #fff, #fff, #fff)
13
- +border-radius(4px)
18
+ +border-radius(4px)
19
+
20
+ input.input-button,
21
+ input.small-input-button
22
+ border: none
23
+ font-size: 15px
24
+ font-family: "Helvetica Neue", "Helvetica", Arial, sans-serif
25
+
26
+ a.small-button,
27
+ input.small-input-button
28
+ padding: 5px 10px
29
+
30
+ .micro-button
31
+ +float_right
32
+ margin: 0px 10px 0px 0px
33
+ font-size: 11px
34
+ padding: 0px 4px
@@ -1,6 +1,7 @@
1
1
  $color1: #0c1550
2
2
  $color2: #1a2363
3
3
  $color3: #f7f8e6
4
+ $color4: #263392
4
5
  $border-color: #cdcdcd
5
6
 
6
7
  body
@@ -11,14 +12,25 @@ body
11
12
 
12
13
  #kuhsaft-wrapper
13
14
  //background: #e9e9e9 url(/images/kuhsaft/wrapper-bg.png) repeat-x left 100px
15
+ width: 960px
16
+ margin: 0 auto
14
17
 
15
18
  .hidden
16
19
  display: none
17
20
 
18
21
  .cms-header
19
22
  background: url(/images/kuhsaft/header-bg.jpg)
20
- border-bottom: 1px solid #7c7a7f
21
- +min-height(200px)
23
+ border-bottom: 1px solid #cccccb
24
+ +min-height(150px)
25
+
26
+ .meta-actions
27
+ +float_right
28
+ margin: 10px 25px 0px 0px
29
+
30
+ .logout-box
31
+ +float_right
32
+ margin: 0px 10px 0px 0px
33
+ font-size: 11px
22
34
 
23
35
  .page-tree-breadcrumb
24
36
  margin-bottom: 20px
@@ -38,11 +50,11 @@ body
38
50
  border:
39
51
  top: 1px solid #7c7a7f
40
52
  right: 1px solid #7c7a7f
41
- margin-top: -61px
53
+ margin: -41px 35px 0px 0px
42
54
 
43
55
  a
44
56
  background: $color1
45
- padding: 10px 15px
57
+ padding: 12px 15px
46
58
  line-height: 40px
47
59
  border-left: 1px solid #ccc
48
60
  +link-colors(#fff, #fff, #fff, #fff, #fff)
@@ -52,7 +64,6 @@ body
52
64
 
53
65
  li.current
54
66
  border-left: 1px solid #7c7a7f
55
- height: 41px
56
67
  a
57
68
  background: #cccccb url(/images/kuhsaft/module-nav-tab-bg.png) repeat-x
58
69
  border-left: 1px solid #e6e6e6
@@ -60,13 +71,10 @@ body
60
71
  +link-colors($color1, $color2, $color1, $color1, $color1)
61
72
 
62
73
  .cms-content-container
63
- +single-box-shadow(#666, 0px, 2px, 8px)
64
- margin: 20px
65
74
  width: 960px
66
75
 
67
76
  .language-tabs
68
77
  border:
69
- top: 1px solid #cfcfcf
70
78
  bottom: 1px solid #cfcfcf
71
79
  background: #e3e3e3 url(/images/kuhsaft/tab-bg.png) repeat-x
72
80
  height: 40px
@@ -96,6 +104,7 @@ body
96
104
  .cms-content
97
105
  background: #f8f8f8
98
106
  padding: 35px
107
+ +min-height(500px)
99
108
 
100
109
  .box-container
101
110
  border:
@@ -126,9 +135,6 @@ body
126
135
  .draggable-box
127
136
  position: relative
128
137
 
129
- .draggable-box.colored-box
130
- background: $color3 url(/images/kuhsaft/page-part-draggable-area.png) no-repeat top right
131
-
132
138
  h1
133
139
  font-size: 36px
134
140
  font-weight: bold
@@ -148,7 +154,7 @@ h1
148
154
 
149
155
  a
150
156
  text-decoration: none
151
- +link-colors($color1, $color2, $color1, $color1, $color2)
157
+ +link-colors($color1, $color4, $color1, $color1, $color2)
152
158
 
153
159
  .clear
154
160
  clear: both
@@ -181,11 +187,15 @@ a
181
187
  background: #e3e5c5
182
188
  padding: 3px 6px
183
189
  border:
184
- top: 1px solid #d2d3b9
185
190
  left: 1px solid #d2d3b9
186
191
  right: 1px solid #fefff4
187
192
  bottom: 1px solid #fefff4
188
- +border-radius(3px)
193
+ +border-bottom-right-radius(3px)
194
+ +border-bottom-left-radius(3px)
195
+ +float-left
196
+ width: 619px
197
+ margin: -5px 0px 10px 0px
198
+
189
199
 
190
200
  .page-part-destroy
191
201
  font-size: 12px
@@ -197,10 +207,7 @@ a
197
207
  +float_left
198
208
 
199
209
  .page-part-tags
200
- +float_left
201
- width: 626px
202
-
203
- input
210
+ &.string
204
211
  width: 612px
205
212
 
206
213
  .dimmed
@@ -291,21 +298,30 @@ ul.pages-root
291
298
  width: 22px
292
299
  border-left: 0px
293
300
 
301
+ .actions
302
+ height: 30px
303
+ width: 100%
304
+ clear: both
305
+ margin: 0px 0px 0px 0px
306
+ input#kuhsaft_page_submit
307
+ +float_right
308
+
294
309
  .drag-handler
295
- width: 140px
296
- height: 60px
297
- position: absolute
298
- right: 0px
299
- top: 0px
300
- cursor: pointer
310
+ background: $color3 url(/images/kuhsaft/page-part-draggable-area.png) no-repeat top right
311
+ width: 91px
312
+ height: 22px
313
+ margin: 0px 7px 0px 0px
314
+ float: right
315
+ cursor: url(/images/kuhsaft/openhand.cur), default !important
316
+ &:active
317
+ cursor: url(/images/kuhsaft/closedhand.cur), default !important
301
318
 
302
319
  .destroy-handler
303
320
  text-align: right
304
321
  width: 100px
305
- position: absolute
306
- right: 140px
307
- top: 0px
308
- padding-top: 10px
322
+ margin: 0px 10px 0px 0px
323
+ padding: 5px 0px 0px 0px
324
+ +float_right
309
325
 
310
326
  .will-drag
311
327
  border: 1px solid #666
@@ -1,4 +1,4 @@
1
- label.string, label.file, label.integer, label.select
1
+ label.string, label.file, label.integer, label.select, label.text
2
2
  width: 200px
3
3
  +float_left
4
4
 
@@ -19,8 +19,9 @@ div.input
19
19
  font-size: 12px
20
20
  margin-left: 200px
21
21
 
22
- textarea.text.large
23
- height: 400px
22
+ textarea.text
23
+ max-height: 500px
24
+ resize: none
24
25
 
25
26
  .input
26
27
  margin: 5px 0px
@@ -72,4 +73,4 @@ select
72
73
  .darkened-box, .lightened-box
73
74
  input[type='text']:focus, textarea:focus
74
75
  background: $color3
75
- +transition(background, 1s)
76
+ +transition(background, 1s)
@@ -30,9 +30,12 @@ class Kuhsaft::AssetUploader < CarrierWave::Uploader::Base
30
30
 
31
31
  # Create different versions of your uploaded files:
32
32
  version :thumb do
33
- process :resize_to_fill => [100, 100]
33
+ process :resize_images
34
+ def resize_images
35
+ resize_to_fill(100, 100) if @file.present? && @file.content_type.present? && @file.content_type.include?('image')
36
+ end
34
37
  end
35
-
38
+
36
39
  # Add a white list of extensions which are allowed to be uploaded.
37
40
  # For images you might use something like this:
38
41
  def extension_white_list
@@ -7,5 +7,5 @@
7
7
  = link_to asset.name, edit_cms_asset_path(asset)
8
8
  .copy
9
9
  %input.string{ :type => :text, :value => asset.file.url }
10
- = link_to t('.delete'), cms_asset_path(asset), :confirm => t('.confirm'), :method => :delete
10
+ = link_to t('.delete'), cms_asset_path(asset), :confirm => t('.confirm', :filename => asset.filename), :method => :delete
11
11
  .clear
@@ -4,7 +4,7 @@
4
4
  .branch
5
5
  = link_to page.title.presence || t('.not_translated'), edit_cms_page_path(page), :class => ('to-translate' if page.title.blank?)
6
6
  = link_to t('.add'), new_cms_page_path(:parent_id => page.id), :class => 'icon add-child-page'
7
- = link_to t('.delete'), cms_page_path(page), :confirm => t('.confirm'), :method => :delete, :class => 'icon delete' if page.childs.empty?
7
+ = link_to t('.delete'), cms_page_path(page), :confirm => t('.confirm', :page_title => page.title), :method => :delete, :class => 'icon delete' if page.childs.empty?
8
8
  .clear
9
9
  - unless page.childs.empty?
10
10
  %ul.sortable
@@ -12,16 +12,20 @@
12
12
  - @localized_page.page_parts.each do |page_part_object|
13
13
  .colored-box.draggable-box.page-part.can-drag{ :'data-id' => page_part_object.id, :'data-put-url' => cms_page_page_part_path(page_part_object, :page_id => @page) }
14
14
  = localized.fields_for :page_parts, page_part_object do |page_part|
15
- .drag-handler
16
- .destroy-handler
17
- = link_to t('.destroy_page_part'), cms_page_page_part_path(page_part.object, :page_id => @page), :confirm => t('.confirm'), :method => :delete, :remote => true
18
- - unless page_part.object.persisted?
19
- = page_part.input :type, :as => :hidden, :input_html => { :value => page_part.object.class.to_s }
15
+ .actions
16
+ .drag-handler
17
+ - unless page_part.object.persisted?
18
+ = page_part.input :type, :as => :hidden, :input_html => { :value => page_part.object.class.to_s }
20
19
 
21
20
  = render :partial => page_part.object.edit_partial_path, :locals => { :input_form => page_part }
21
+ = page_part.label :tag_list
22
22
  .page-part-helpers
23
- = page_part.input :tag_list, :as => :string, :wrapper_html => { :class => 'page-part-tags' }, :input_html => { :placeholder => t('.separate_by_comma') }
24
- .clear
23
+ = page_part.text_field :tag_list, :placeholder => t('.separate_by_comma'), :class => 'page-part-tags string'
24
+ .actions
25
+ = page.button :submit, :class => 'small-input-button'
26
+ .destroy-handler
27
+ = link_to t('.destroy_page_part'), cms_page_page_part_path(page_part.object, :page_id => @page), :confirm => t('.confirm'), :method => :delete, :remote => true
28
+ .clear
25
29
  - if localized.object.persisted? && !@page.redirect?
26
30
  .lightened-box.add-page-part
27
31
  %label.string{ :for => :page_part_type }= t('.add_element')
@@ -50,10 +54,10 @@
50
54
  = localized.label :published, t('.published_at'), :class => :radio, :for => :kuhsaft_page_localized_pages_attributes_0_published_2
51
55
  = localized.text_field :published_at, :class => 'small string', :placeholder => 'dd.mm.yyyy HH:MM'
52
56
  .column.grid-2
53
- = page.button :submit
57
+ = page.button :submit, :class => 'input-button'
54
58
  .clear
55
59
 
56
60
  :javascript
57
61
  $(".toggle").click(function(){
58
62
  $(this).toggleClass("closed").next(".collapsable").toggleClass("hidden")
59
- })
63
+ })
@@ -3,6 +3,6 @@
3
3
  %li{ :class => (:current if params[:locale] == locale.to_s) }= link_to locale.to_s, cms_pages_path(:locale => locale)
4
4
 
5
5
  - content_for :admin_toolbar do
6
- = link_to t('.create'), new_cms_page_path, :class => 'button'
6
+ = link_to t('.create'), new_cms_page_path, :class => 'small-button'
7
7
  %ul.pages-root.sortable
8
8
  = render :partial => 'branch', :locals => { :pages => @pages }
@@ -1 +1 @@
1
- = input_form.input :text, :as => :text, :input_html => { :class => :large }
1
+ = input_form.input :text, :as => :text, :input_html => { :class => :small }
@@ -2,24 +2,30 @@
2
2
  %html
3
3
  %head
4
4
  = stylesheet_link_tag 'kuhsaft/cms/screen.css', :media => 'screen, projection'
5
- = stylesheet_link_tag 'kuhsaft/ui-lightness/jquery-ui-1.8.12.custom.css', :media => 'screen, projection'
6
- = csrf_meta_tag
7
- = javascript_include_tag 'kuhsaft/cms/jquery-1.4.4.js'
5
+ = javascript_include_tag 'kuhsaft/cms/jquery.min.js'
8
6
  = javascript_include_tag 'kuhsaft/cms/jquery-ui-1.8.12.custom.min.js'
9
- = javascript_include_tag 'kuhsaft/cms/rails.js'
7
+ = javascript_include_tag 'kuhsaft/cms/jquery_ujs.js'
8
+ = javascript_include_tag 'kuhsaft/cms/jquery.elastic.source.js'
10
9
  = javascript_include_tag 'kuhsaft/cms/application.js'
10
+ = csrf_meta_tag
11
11
  %body{ :class => "#{controller_name}" }
12
12
  #kuhsaft-wrapper
13
13
  .cms-header
14
14
  .container
15
- - if respond_to?(:destroy_user_session_path)
16
- = link_to(t('.logout'), destroy_user_session_path, :class => :logout)
15
+ .meta-actions
16
+ %a.micro-button{ :href => '/', :target => '_blank' }
17
+ View Site
18
+ .logout-box
19
+ - if respond_to?(:destroy_user_session_path)
20
+ = current_user.first_name
21
+ = current_user.last_name
22
+ = link_to '(logout)', destroy_user_session_path, :class => 'logout micro-logout'
17
23
  .cms-content-container
18
24
  %ul.cms-module-nav
19
25
  = admin_tab(t('.pages_nav'), cms_pages_path)
20
26
  = admin_tab(t('.assets_nav'), cms_assets_path)
21
27
  = render :partial => 'cms/admin_navigation' rescue ''
22
- .clear
28
+ .clear
23
29
  %ul.language-tabs
24
30
  = yield :cms_language_tabs
25
31
  .clear
@@ -30,4 +36,4 @@
30
36
  = yield :before_admin_content
31
37
  = yield
32
38
  = yield :after_admin_content
33
- = yield :scripts
39
+ = yield :scripts
@@ -19,14 +19,14 @@ en:
19
19
  add: 'Add page'
20
20
  create: 'Create new page'
21
21
  delete: 'Remove page'
22
- confirm: 'Are you sure?'
22
+ confirm: 'Are you sure you want to delete the page "%{page_title}"?'
23
23
  not_translated: 'Not yet translated'
24
24
  form:
25
25
  add_page_part: 'Add element'
26
26
  unpublished: "Save page offline"
27
27
  published: "Publish page"
28
28
  published_at: "Go online on"
29
- confirm: 'Are you sure?'
29
+ confirm: 'Are you sure you want to delete this page part?'
30
30
  destroy_page_part: 'Delete'
31
31
  separate_by_comma: 'Separate tags by comma'
32
32
  current_translation_locale: 'Current translation: %{translation_locale}'
@@ -34,7 +34,7 @@ en:
34
34
  index:
35
35
  create: 'Create new asset'
36
36
  list:
37
- confirm: 'Are you sure?'
37
+ confirm: 'Are you sure you want to delete the asset "%{filename}"?'
38
38
  delete: 'Delete asset'
39
39
  simple_form:
40
40
  labels:
data/kuhsaft.gemspec CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency 'guard-spork'
29
29
  s.add_development_dependency 'guard-rspec'
30
30
  s.add_development_dependency 'growl'
31
+ s.add_development_dependency 'linecache', '0.42'
31
32
 
32
33
  s.add_dependency 'rails', '~>3.0'
33
34
  s.add_dependency 'haml', '~> 3.1'
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
Binary file
@@ -20,12 +20,15 @@ $(function(){
20
20
  })
21
21
 
22
22
  $(".page-part-list .drag-handler").mouseenter(function(){
23
- $(this).parent().addClass("will-drag")
23
+ $(this).parent().parent().addClass("will-drag")
24
24
  })
25
25
  .mouseleave(function(){
26
- $(this).parent().removeClass("will-drag")
26
+ $(this).parent().parent().removeClass("will-drag")
27
27
  })
28
28
  $(".draggable-box").mouseleave(function(){
29
29
  $(this).removeClass("will-drag")
30
30
  })
31
+
32
+ $('.colored-box textarea.text').elastic();
33
+
31
34
  })