sbdevcore 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/app/assets/javascripts/sbdev-ajax.js +4 -4
  2. data/app/assets/javascripts/sbdevcore-tools.js +15 -67
  3. data/app/assets/javascripts/sbdevcore.js +1 -1
  4. data/app/assets/stylesheets/_forms.scss +0 -1
  5. data/app/assets/stylesheets/_gallery.scss +73 -111
  6. data/app/assets/stylesheets/_overlay.scss +0 -1
  7. data/app/assets/stylesheets/_sbdev_core.scss +13 -4
  8. data/app/assets/stylesheets/_yui_base.scss +2 -2
  9. data/app/controllers/galleries_controller.rb +1 -1
  10. data/app/controllers/indices_controller.rb +1 -0
  11. data/app/controllers/sbdev_core_controller.rb +1 -1
  12. data/app/models/gallery.rb +8 -1
  13. data/app/models/index.rb +20 -2
  14. data/app/models/photo.rb +5 -6
  15. data/app/views/application/_secondary_nav.html.haml +1 -1
  16. data/app/views/downloadables/new.html.haml +2 -4
  17. data/app/views/galleries/_form.html.haml +1 -21
  18. data/app/views/galleries/_show.html.haml +15 -0
  19. data/app/views/galleries/edit.html.haml +1 -6
  20. data/app/views/galleries/new.html.haml +2 -2
  21. data/app/views/indices/_form.html.haml +6 -41
  22. data/app/views/indices/_show.html.haml +15 -6
  23. data/app/views/indices/new.html.haml +3 -0
  24. data/app/views/indices/show.html.haml +2 -2
  25. data/app/views/layouts/application.html.haml +1 -0
  26. data/app/views/photos/new.html.haml +2 -3
  27. data/app/views/sbdev_core/index.html.haml +1 -1
  28. data/app/views/sbdev_core/show.html.haml +1 -1
  29. data/app/views/texts/new.html.haml +2 -3
  30. data/app/views/videos/new.html.haml +2 -4
  31. data/config/initializers/simple_form.rb +3 -3
  32. data/db/migrate/20110811000613_create_indices.rb +1 -0
  33. data/lib/generators/sbdevcore/install_generator.rb +3 -2
  34. data/lib/generators/sbdevcore/templates/sass.scss +0 -1
  35. data/lib/sbdevcore.rb +3 -1
  36. data/lib/sbdevcore/version.rb +1 -1
  37. data/sbdevcore.gemspec +1 -1
  38. metadata +35 -35
  39. data/config/initializers/load_app_config.rb +0 -2
  40. data/lib/generators/sbdevcore/templates/config/initializers/simple_form.rb +0 -93
@@ -8,7 +8,6 @@ $.ajaxSetup({
8
8
  function ajax_complete_defaults(data){
9
9
  $("#main").removeClass('ajax-loader');
10
10
  $("#main").html(data);
11
- bind_functions("#main");
12
11
  $('title').html($("#content_for_title").html());
13
12
  $("#content_for_title").remove();
14
13
  $("meta[name='description']").attr("content",$("#content_for_page_description").html());
@@ -17,6 +16,9 @@ function ajax_complete_defaults(data){
17
16
  $("#content_for_keywords").remove();
18
17
  $('#sidebar').html($("#content_for_sidebar").html());
19
18
  $("#content_for_sidebar").remove();
19
+ $('#post_content').html($("#content_for_post_content").html());
20
+ $("#content_for_post_content").remove();
21
+ bind_functions("#main");
20
22
  }
21
23
 
22
24
  $(document).ready(function (){
@@ -25,11 +27,9 @@ $(document).ready(function (){
25
27
  });
26
28
 
27
29
  $("a[data-remote]").live('ajax:complete', function(status, xhr) {
28
- ajax_complete_defaults(xhr.responseText);
29
- $($(this).closest('div')).find('.current').removeClass('current');
30
- $(this).addClass('current');
31
30
  ajaxed = true;
32
31
  History.pushState(null,'',$(this).attr('href'));
32
+ ajax_complete_defaults(xhr.responseText);
33
33
  });
34
34
 
35
35
  $(window).bind('statechange',function(){
@@ -1,49 +1,16 @@
1
1
  $.tools.tabs.addEffect("myAjax", function(tabIndex, done) {
2
- $.get(
3
- this.getTabs().eq(tabIndex).attr('href'),
4
- {},
5
- done,
6
- "script"
7
- );
8
- });
9
-
10
- jQuery.fn.submitWithAjax = function () {
11
- this.submit(function () {
12
- $.post($(this).attr('action'), $(this).serialize(), null, "script");
13
- return false;
14
- });
15
- };
16
-
17
- jQuery.fn.ajaxDelete = function () {
18
- this.click( function(event) {
19
- event.preventDefault();
20
- $.post(
21
- this.href,
22
- { _method: 'delete' },
23
- null,
24
- 'script'
25
- );
26
- $(this).closest('li').hide();
2
+ $.ajax({
3
+ url: this.getTabs().eq(tabIndex).attr('href'),
4
+ beforeSend: function(){$("#gallery_wrap_inner").addClass('ajax-loader');},
5
+ success: [
6
+ function(data){$('#gallery_wrap_inner').html(data);},
7
+ function(){bind_functions("#gallery_wrap_inner")},
8
+ function(){$("#gallery_wrap_inner").removeClass('ajax-loader');},
9
+ function(){$(this).addClass('current');},
10
+ done
11
+ ]
27
12
  });
28
- return false;
29
- };
30
-
31
- jQuery.fn.ajaxLink = function () {
32
- this.click( function(event) {
33
- event.preventDefault();
34
- if ($(this).hasClass("current")) { return; }
35
- if($(this).hasClass('button')) {
36
- $($(this).closest('.ajax-nav')).find('.current').removeClass('current');
37
- $(this).addClass('current');
38
- }
39
- $.get(
40
- this.href,
41
- {},
42
- null,
43
- "script"
44
- );
45
- });
46
- };
13
+ });
47
14
 
48
15
  jQuery.fn.toggleable = function () {
49
16
  this.click( function(event) {
@@ -71,28 +38,8 @@ jQuery.fn.highlightDiv = function(){
71
38
  );
72
39
  };
73
40
 
74
- function remove_fields(link) {
75
- $(link).parent().prev("input[type=hidden]").val("1");
76
- $(link).closest(".nested_fields").hide();
77
- }
78
-
79
- function add_nested(link, association, content, hide) {
80
- var new_id = new Date().getTime();
81
- var regexp = new RegExp("new_" + association, "g");
82
- $(link).parent().before(content.replace(regexp, new_id));
83
- if(hide){
84
- $(link).hide();
85
- }
86
- if (content.match(/mceEditor/i)){
87
- var id = $(".mceEditor", content.replace(regexp, new_id)).attr("id");
88
- tinyMCE.execCommand('mceAddControl', true, id);
89
- }
90
- if (content.match(/date/i)){
91
- $(".date").dateinput({min: 0, yearRange: [0,2], format: 'ddd, mmmm d, yyyy'});
92
- }
93
- }
94
-
95
41
  function set_currents(){
42
+ $(".button").not("#gallery .button").removeClass('current');
96
43
  $('[href="'+window.location.pathname.match(/\/\w*/i)+'"]').addClass("current");
97
44
  $('[href="'+window.location.pathname+'"]').addClass("current");
98
45
  if(window.location.pathname === '/') {
@@ -108,6 +55,7 @@ function setOverlay(context){
108
55
  $(".overlayed", context).overlay({
109
56
  fixed: false,
110
57
  target: '#overlay',
58
+ top: 0,
111
59
  onBeforeLoad: function() {
112
60
  var wrap = this.getOverlay().find(".contentWrap");
113
61
  var url = this.getTrigger().attr("href");
@@ -153,10 +101,10 @@ function bind_functions(context){
153
101
  setOverlay(context);
154
102
  spellcheck(context);
155
103
  $('form[data-validate]', context).validate();
104
+ set_currents();
156
105
  $(".scrollable", context).scrollable();
106
+ $(".items", context).tabs("#gallery_wrap_inner", {effect: 'myAjax', rotate: true}).slideshow({clickable: false});
157
107
  paginateAjax(context);
158
- $(".items", context).tabs("#gallery_wrap div", {effect: 'myAjax', history: true, rotate: true}).slideshow({clickable: false, history: true});
159
- set_currents();
160
108
  }
161
109
 
162
110
  $(document).ready(function (){
@@ -13,5 +13,5 @@
13
13
  //= require history.adapter.jquery
14
14
  //= require history
15
15
  //= require history.html4
16
- //= require sbdev-ajax.js
17
16
  //= require sbdevcore-tools.js
17
+ //= require sbdev-ajax.js
@@ -11,7 +11,6 @@
11
11
  textarea {
12
12
  margin: 3px;
13
13
  display: inline;
14
- width: auto;
15
14
  }
16
15
 
17
16
  label {
@@ -1,129 +1,91 @@
1
1
  #gallery {
2
- width: 676px;
3
- margin: 10px auto;
4
- display: block;
5
- }
6
-
7
- #gallery_wrap {
8
- /* dimensions */
9
- margin: 0 auto;
10
- /* centered */
11
- text-align:center;
12
- min-height: 666px;
2
+ a.browse {
3
+ background:url(/assets/hori_large.png) no-repeat;
4
+ display:block;
5
+ width:30px;
6
+ height:30px;
7
+ cursor:pointer;
8
+ font-size:1px;
9
+ }
10
+ a.right { background-position: 0 -30px; clear:right; margin-right: 0px; float: right;}
11
+ a.right:hover { background-position:-30px -30px; }
12
+ a.right:active { background-position:-60px -30px; }
13
+
14
+
15
+ /* left */
16
+ a.left { margin-left: 0px; }
17
+ a.left:hover { background-position:-30px 0; }
18
+ a.left:active { background-position:-60px 0; }
19
+
20
+ a.disabled {
21
+ visibility:hidden !important;
22
+ }
13
23
  }
14
24
 
15
25
  #gallery_wrap a.browse {
16
- margin-top: 300px !important;
26
+ margin: 15px 10px 0;
17
27
  }
28
+
18
29
  #gallery_wrap_inner {
19
- width: 596px;
20
- margin: 0;
21
- }
22
- #gallery_wrap img {
23
- max-width: 566px;
24
- max-height: 660px;
30
+ width: 90%;
31
+ margin: 0 auto;
32
+ .title {
33
+ width: 100%;
34
+ margin: 0 auto;
35
+ left: 0;
36
+ padding: 10px 0;
37
+ @include corners-all($corner-radius);
38
+ text-align: center;
39
+ }
40
+ img {
41
+ max-width: 566px;
42
+ max-height: 660px;
43
+ }
25
44
  }
26
45
 
27
46
  .scroll_nav {
28
47
  margin: 0 auto;
29
- width: 676px;
48
+ width: 700px;
49
+ a.browse {
50
+ margin: 62.5px 10px 0;
51
+ }
52
+
30
53
  }
31
- /*
32
- root element for the scrollable.
33
- when scrolling occurs this element stays still.
34
- */
54
+
35
55
  .scrollable {
36
56
 
37
- /* required settings */
38
- position:relative;
39
- overflow:hidden;
40
- width: 596px;
41
- height:160px;
57
+ position:relative;
58
+ overflow:hidden;
59
+ width: 620px;
60
+ height:155px;
42
61
  padding: 0;
43
62
  margin: 0;
44
63
  float:left;
45
-
46
- /* custom decorations */
47
64
  background-color: transparent;
48
- }
49
-
50
- .items div {
51
- float:left;
52
- width:600px;
53
- }
54
-
55
- /* single scrollable item */
56
- .scrollable .button {
57
- float:left;
58
- margin: 7px;
59
- padding: 5px !important;
60
- height:130px;
61
- width:125px;
62
- border: none;
63
- }
64
-
65
- .scrollable img {
66
- max-height:120px;
67
- max-width:125px;
68
- margin: 0;
69
- padding: 0;
70
- }
71
-
72
-
73
- /*
74
- root element for scrollable items. Must be absolutely positioned
75
- and it should have a extremely large width to accomodate scrollable items.
76
- it's enough that you set the width and height for the root element and
77
- not for this element.
78
- */
79
- .scrollable .items {
80
- /* this cannot be too large */
81
- width:20000em;
82
- position:absolute;
83
- clear:both;
84
- }
85
-
86
- /* prev, next, prevPage and nextPage buttons */
87
- a.browse {
88
- background:url(../images/hori_large.png) no-repeat;
89
- display:block;
90
- width:30px;
91
- height:30px;
92
- float:left;
93
- margin:50px 10px 0;
94
- cursor:pointer;
95
- font-size:1px;
96
- }
97
-
98
- /* right */
99
- a.right { background-position: 0 -30px; clear:right; margin-right: 0px;}
100
- a.right:hover { background-position:-30px -30px; }
101
- a.right:active { background-position:-60px -30px; }
102
-
103
-
104
- /* left */
105
- a.left { margin-left: 0px; }
106
- a.left:hover { background-position:-30px 0; }
107
- a.left:active { background-position:-60px 0; }
108
-
109
- /* up and down */
110
- /*a.up, a.down {*/
111
- /*background:url(../img/scrollable/arrow/vert_large.png) no-repeat;*/
112
- /*float: none;*/
113
- /*margin: 10px 50px;*/
114
- /*}*/
115
-
116
- /* up */
117
- /*a.up:hover { background-position:-30px 0; }*/
118
- /*a.up:active { background-position:-60px 0; }*/
119
-
120
- /* down */
121
- /*a.down { background-position: 0 -30px; }*/
122
- /*a.down:hover { background-position:-30px -30px; }*/
123
- /*a.down:active { background-position:-60px -30px; }*/
124
-
125
-
126
- /* disabled navigational button */
127
- a.disabled {
128
- visibility:hidden !important;
65
+ .button {
66
+ float:left;
67
+ padding: 5px !important;
68
+ height:125px;
69
+ width:125px;
70
+ border: none;
71
+ overflow: hidden;
72
+ }
73
+
74
+ img {
75
+ max-height:125px;
76
+ max-width:125px;
77
+ margin: 0;
78
+ padding: 0;
79
+ }
80
+
81
+ .items {
82
+ /* this cannot be too large */
83
+ width:20000em;
84
+ position:absolute;
85
+ clear:both;
86
+ div {
87
+ float:left;
88
+ width:620px;
89
+ }
90
+ }
129
91
  }
@@ -11,7 +11,6 @@
11
11
  width: $content-width - 100px;
12
12
  padding: 20px;
13
13
  min-height:200px;
14
- top: 0 !important;
15
14
  @include box-shadow(50px);
16
15
  @include corners-all(10px);
17
16
  }
@@ -53,23 +53,32 @@ body {
53
53
  #sidebar {
54
54
  width: 30%;
55
55
  float: right;
56
+ margin-left: 5px;
56
57
  background-color: $content-background-color;
57
58
  border-left: 1px dashed silver;
58
59
  #secondary_nav {
59
60
  .button {
60
61
  position: relative;
61
62
  width: 90%;
62
- padding-right: 20px;
63
63
  @include corners-left($corner-radius);
64
+ font-size: 101%;
64
65
  float: right;
65
- right: -20px;
66
+ right: -10px;
66
67
  @include box-shadow(0);
68
+ text-align: left;
67
69
  }
68
70
  .secondary {
69
- width: 88%;
71
+ width: 84%;
72
+ float: left;
73
+ margin-left: 20px;
70
74
  border-top: 1px dashed silver;
71
75
  @include corners-all(0);
72
76
  }
77
+ li:hover {
78
+ & .tertiary_nav {
79
+ display: inline;
80
+ }
81
+ }
73
82
  }
74
83
  }
75
84
 
@@ -81,7 +90,7 @@ body {
81
90
  margin: 0;
82
91
  color: $content-background-color;
83
92
  position: relative;
84
- left: -10px;
93
+ left: -15px;
85
94
  @include corners-right($corner-radius);
86
95
  }
87
96
 
@@ -111,11 +111,11 @@ ol, ul, dl {
111
111
 
112
112
  ol li {
113
113
  /*giving OL's LIs generated numbers*/
114
- list-style: decimal outside; }
114
+ list-style: decimal inside; }
115
115
 
116
116
  ul li {
117
117
  /*giving UL's LIs generated disc markers*/
118
- list-style: disc outside; }
118
+ list-style: disc inside; }
119
119
 
120
120
  dl dd {
121
121
  /*providing spacing for definition terms*/
@@ -1,5 +1,5 @@
1
1
  class GalleriesController < SbdevCoreController
2
2
  before_filter :authenticate_admin!
3
3
  skip_before_filter :get_index
4
- belongs_to :index, :optional => true
4
+ nested_belongs_to :index, :optional => true, :singleton => true
5
5
  end
@@ -1,3 +1,4 @@
1
1
  class IndicesController < SbdevCoreController
2
2
  before_filter :authenticate_admin!, :only => [:index]
3
+ nested_belongs_to :gallery, :polymorphic => true, :optional => true
3
4
  end
@@ -39,6 +39,6 @@ class SbdevCoreController < InheritedResources::Base
39
39
  private
40
40
 
41
41
  def get_index
42
- @index = Index.find_by_name(controller_name)
42
+ @index = Index.find(controller_name)
43
43
  end
44
44
  end
@@ -1,7 +1,14 @@
1
1
  class Gallery < ActiveRecord::Base
2
+ attr_accessible :title
2
3
  belongs_to :index
3
4
 
4
- has_many :indices, :as => :owner, :dependent => :destroy, :order => "priority ASC"
5
+ has_many :indices, :as => :owner, :dependent => :destroy
5
6
 
6
7
  accepts_nested_attributes_for :indices, :allow_destroy => true
8
+
9
+ validates_presence_of :title
10
+
11
+ def name
12
+ title.downcase.gsub(" ", "_")
13
+ end
7
14
  end
data/app/models/index.rb CHANGED
@@ -1,12 +1,24 @@
1
1
  class Index < ActiveRecord::Base
2
2
  attr_accessible :name, :title, :page_title, :keywords, :page_description, :texts_attributes, :photos_attributes, :videos_attributes, :downloadables_attributes, :gallery_attributes
3
3
 
4
- has_many :indices, :as => :owner, :dependent => :destroy
5
- belongs_to :owner, :polymorphic => true
4
+ delegate :asset, :to => :"photos.first", :allow_nil => true
5
+ alias_method :photo, :asset
6
+
7
+ before_validation :default_name
6
8
 
7
9
  extend FriendlyId
8
10
  friendly_id :name, :use => :slugged
9
11
 
12
+ include ActsAsPrioritizable
13
+ acts_as_prioritizable("owner", "indices")
14
+ default_scope :order => 'priority ASC'
15
+ after_initialize do
16
+ self.priority ||= lowest_priority + 1
17
+ end
18
+
19
+ has_many :indices, :as => :owner, :dependent => :destroy
20
+ belongs_to :owner, :polymorphic => true
21
+
10
22
  has_one :gallery, :dependent => :destroy
11
23
 
12
24
  has_many :texts, :dependent => :destroy
@@ -21,7 +33,13 @@ class Index < ActiveRecord::Base
21
33
 
22
34
  accepts_nested_attributes_for :gallery, :allow_destroy => true
23
35
 
36
+ validates_presence_of :title
37
+
24
38
  def assets
25
39
  (texts + photos + videos + downloadables).sort_by{|a| a.priority || 99}
26
40
  end
41
+
42
+ def default_name
43
+ self.name ||= self.title.tableize
44
+ end
27
45
  end
data/app/models/photo.rb CHANGED
@@ -6,8 +6,11 @@ class Photo < ActiveRecord::Base
6
6
 
7
7
  include ActsAsPrioritizable
8
8
  acts_as_prioritizable("index", "assets")
9
-
10
- after_initialize :defaults
9
+ default_scope :order => 'priority ASC'
10
+ after_initialize do
11
+ self.klass ||= "center"
12
+ self.priority ||= lowest_priority + 1
13
+ end
11
14
 
12
15
  has_attached_file :asset,
13
16
  :styles => {
@@ -56,8 +59,4 @@ class Photo < ActiveRecord::Base
56
59
  filename = asset_file_name.gsub(/\.#{extension}$/, '')
57
60
  self.asset.instance_write(:file_name, "#{transliterate(filename)}.#{transliterate(extension)}")
58
61
  end
59
-
60
- def defaults
61
- self.klass ||= "center"
62
- end
63
62
  end
@@ -1,4 +1,4 @@
1
1
  #secondary_nav
2
- = link_to @index.title.titleize, collection_url, :class => 'button current', :remote => true
2
+ = link_to @index.title.titleize, @index.title, :class => 'button current', :remote => true
3
3
  -collection.each do |page|
4
4
  = link_to page.index.title.titleize, page, :class => 'button secondary', :remote => true
@@ -1,4 +1,2 @@
1
- = simple_form_for @index, :validate => true, :html => { :multipart => true} do |f|
2
- = f.simple_fields_for :downloadables, @downloadable do |downloadable_form|
3
- = render "downloadables/form", :locals => {:f => downloadable_form}
4
- = f.button :submit
1
+ = simple_form_for [@index, @downloadable], :validate => true, :html => { :multipart => true} do |f|
2
+ = render "downloadables/form", :locals => {:f => f}
@@ -1,22 +1,2 @@
1
1
  - f ||= local_assigns[:locals][:f]
2
- .nested_fields
3
- .nested_fields
4
- %p
5
- = f.label "Gallery Title"
6
- %br/
7
- = f.text_field :title
8
- .nested_fields
9
- %h4 Gallery Photos
10
- #photos
11
- = f.fields_for :photos do |photo_form|
12
- = render "photos/form", :locals => {:f => photo_form}
13
- %p= link_to_add_nested('Add Photo', f, :photos, 'photos')
14
- .nested_fields
15
- %h4 Gallery Videos
16
- #videos
17
- = f.fields_for :videos do |video_form|
18
- = render "videos/form", :locals => {:f => video_form}
19
- %p= link_to_add_nested('Add Video', f, :videos, 'videos')
20
- - unless f.object.new_record?
21
- = f.hidden_field :_destroy
22
- %p= link_to_function "Remove Gallery", "remove_fields(this)", :class => "remove"
2
+ = f.input :title
@@ -0,0 +1,15 @@
1
+ - indices ||= local_assigns[:indices]
2
+ #gallery.clearfix
3
+ #gallery_wrap.clearfix
4
+ %a{:class => "#{'no_back ' unless (indices.size > 1)}backward browse left"}
5
+ %a{:class => "#{'no_back ' unless (indices.size > 1)}forward browse right"}
6
+ #gallery_wrap_inner
7
+ .scroll_nav.clearfix
8
+ %a{:class => "#{'no_back ' unless (indices.size > 4)}prev browse left"}
9
+ .scrollable.corner-all.nav
10
+ .items.ajax-nav
11
+ - indices.each_with_index do |index, i|
12
+ =raw '<div>' if i%4 == 0
13
+ = link_to image_tag(index.photo.try(:url,:thumb), :alt => index.title), index, :class => "button#{' current' if index.id == indices.first.id}"
14
+ =raw '</div>' if (i%4 == 3 || i == indices.size-1)
15
+ %a{:class => "#{'no_back ' unless (indices.size > 4)}next browse right"}
@@ -1,10 +1,5 @@
1
- - title "Edit Gallery"
2
1
  = simple_form_for @gallery, :validate => true, :html => { :multipart => true } do |f|
3
2
  = f.error_messages
4
3
  = f.button :submit
5
4
  = render :partial => 'form'
6
- = f.button :submit
7
- %p
8
- = link_to "Show", @gallery
9
- |
10
- \#{link_to "View All", galleries_path}
5
+ = f.button :submit
@@ -1,3 +1,3 @@
1
- = simple_form_for @gallery, :validate => true, :html => { :multipart => true } do |f|
2
- = render :partial => 'form'
1
+ = simple_form_for [@index, @gallery], :url => index_gallery_path(@index), :validate => true, :html => { :multipart => true} do |f|
2
+ = render "galleries/form", :locals => {:f => f}
3
3
  = f.button :submit
@@ -1,43 +1,8 @@
1
1
  - f ||= local_assigns[:locals][:f]
2
2
  - index ||= f.object
3
- - seo ||= (local_assigns[:locals][:seo] rescue true)
4
- - side ||= (local_assigns[:locals][:side] rescue true)
5
- - gallery ||= (local_assigns[:locals][:gallery] rescue true)
6
- %p
7
- = index.name
8
- %h4 Content Sections
9
- .pane.clearfix
10
- = f.fields_for :content_sections, index.content_sections do |section_form|
11
- = render "sections/form", :locals => {:f => section_form, :alignment => true}
12
- %p= link_to_add_nested('Add Section', f, :content_sections, 'sections')
13
- - if seo
14
- %h4 Search Engine Info
15
- .pane.clearfix
16
- %p
17
- = f.label :page_title
18
- %br/
19
- = f.text_field :page_title
20
- %p
21
- = f.label :keywords
22
- %br/
23
- = f.text_area :keywords, :rows => 5
24
- %p
25
- = f.label :page_description
26
- %br/
27
- = f.text_area :page_description, :rows => 10
28
- - if side
29
- %h4 Side Bar Section
30
- - if index.side_section.nil?
31
- %p= link_to_add_nested('Add Side Section', f, :side_section, 'sections', false, true)
32
- - else
33
- .pane.clearfix
34
- = f.fields_for :side_section, index.side_section do |section_form|
35
- = render "sections/form", :locals => {:f => section_form}
36
- - if side
37
- %h4 Gallery
38
- - if index.gallery.nil?
39
- %p= link_to_add_nested('Add Gallery', f, :gallery, 'galleries', false, true)
40
- - else
41
- .pane.clearfix
42
- = f.fields_for :gallery, index.gallery do |section_form|
43
- = render "galleries/form", :locals => {:f => section_form}
3
+ %div{:id => f.object.id.to_s}
4
+ = f.input :title
5
+ = f.input(:page_title) unless index.owner.is_a?(Gallery)
6
+ = f.input(:keywords, :input_html => { :rows => 5 }) unless index.owner.is_a?(Gallery)
7
+ = f.input(:page_description, :input_html => { :rows => 5 }) unless index.owner.is_a?(Gallery)
8
+ = render("shared/prioritizable_fields", :locals => {:f => f}) unless index.owner.nil?
@@ -1,6 +1,6 @@
1
1
  - index ||= local_assigns[:index]
2
2
  - render_seo index
3
- %div{:id => "index#{index.id}"}
3
+ .asset
4
4
  %h1.title=index.title.titleize
5
5
  = render :partial => 'shared/asset_show', :collection => index.assets, :as => :asset
6
6
  - if admin_signed_in?
@@ -10,12 +10,21 @@
10
10
  = link_to "Add Photo", new_index_photo_path(index.id), :rel=>"#overlay", :class => "overlayed"
11
11
  = link_to "Add Video", new_index_video_path(index.id), :rel=>"#overlay", :class => "overlayed"
12
12
  = link_to "Add Downloadable File", new_index_downloadable_path(index.id), :rel=>"#overlay", :class => "overlayed"
13
- - unless index.gallery.nil?
14
- - content_for :post_content do
15
- .content.corner-all.box-shadow
16
- = render :partial => "shared/gallery", :locals => {:objs => index.gallery.assets}
17
- - if request.xhr?
13
+ = link_to "Add Gallery", new_index_gallery_path(index.id), :rel=>"#overlay", :class => "overlayed" if (index.gallery.nil? && !index.owner.is_a?(Gallery))
14
+ %p.asset-admin
15
+ = link_to "Edit Page", edit_index_path(index.id), :rel=>"#overlay", :class => "overlayed"
16
+ = link_to("Remove Page", index, :confirm => 'Are you sure?', :method => :delete) if index.owner.is_a?(Gallery)
17
+ - unless index.gallery.nil?
18
+ =content_for(:post_content) do
19
+ - if admin_signed_in?
20
+ .asset
21
+ %p.asset-admin
22
+ = link_to "Add Gallery Page", new_gallery_index_path(index.gallery.id), :rel=>"#overlay", :class => "overlayed"
23
+ = render(:partial => "galleries/show", :object => index.gallery.indices, :as => :indices) unless index.gallery.indices.empty?
24
+ - if(request.xhr?)
18
25
  .content_for.hidden
26
+ #content_for_post_content
27
+ =@view_flow.get(:post_content)
19
28
  #content_for_title
20
29
  =@view_flow.get(:title)
21
30
  #content_for_keywords
@@ -0,0 +1,3 @@
1
+ = simple_form_for [@gallery, @index], :html => { :multipart => true} do |f|
2
+ = render "indices/form", :locals => {:f => f}
3
+ = f.button :submit
@@ -1,9 +1,9 @@
1
1
  =content_for(:sidebar) do
2
2
  #secondary_nav
3
3
  - nav = resource.owner.nil? ? resource : resource.owner
4
- = link_to nav.title.titleize, nav.title, :class => 'button current', :remote => true
4
+ = link_to nav.title.titleize, "/" + nav.name, :class => 'button current', :remote => true
5
5
  -nav.indices.each do |page|
6
- = link_to page.title.titleize, page.name, :class => 'button secondary', :remote => true
6
+ = link_to page.title.titleize, "/" + page.name, :class => 'button secondary', :remote => true
7
7
 
8
8
  =(render :partial => 'show', :object => resource, :as => resource_class.to_s.downcase.to_sym)
9
9
  - if request.xhr?
@@ -21,6 +21,7 @@
21
21
  = yield(:sidebar)
22
22
  #main
23
23
  = yield
24
+ = yield(:post_content)
24
25
  = render 'application/footer'
25
26
  #overlay.overlay
26
27
  .contentWrap
@@ -1,4 +1,3 @@
1
- = simple_form_for @index, :validate => true, :html => { :multipart => true} do |f|
2
- = f.simple_fields_for :photos, @photo do |photo_form|
3
- = render "photos/form", :locals => {:f => photo_form}
1
+ = simple_form_for [@index, @photo], :validate => true, :html => { :multipart => true} do |f|
2
+ = render "photos/form", :locals => {:f => f}
4
3
  = f.button :submit
@@ -1,5 +1,5 @@
1
1
  =content_for(:sidebar) do
2
- =render :partial => "application/secondary_nav", :collection => collection
2
+ =render :partial => "application/secondary_nav"
3
3
 
4
4
  =(render :partial => 'indices/show', :object => @index, :as => :index)
5
5
  - if request.xhr?
@@ -1,2 +1,2 @@
1
- =(render :partial => 'show', :object => resource, :as => resource_class.to_s.downcase.to_sym)
2
1
  =(render :partial => 'indices/show', :object => resource.index, :as => :index)
2
+ =(render :partial => 'show', :object => resource, :as => resource_class.to_s.downcase.to_sym)
@@ -1,4 +1,3 @@
1
- = simple_form_for @index, :html => { :multipart => true} do |f|
2
- = f.simple_fields_for :texts, @text do |text_form|
3
- = render "texts/form", :locals => {:f => text_form}
1
+ = simple_form_for [@index, @text], :html => { :multipart => true} do |f|
2
+ = render "texts/form", :locals => {:f => f}
4
3
  = f.button :submit
@@ -1,4 +1,2 @@
1
- = simple_form_for @index, :validate => true, :html => { :multipart => true} do |f|
2
- = f.simple_fields_for :videos, @video do |video_form|
3
- = render "videos/form", :locals => {:f => video_form}
4
- = f.button :submit
1
+ = simple_form_for [@index, @video], :validate => true, :html => { :multipart => true} do |f|
2
+ = render "videos/form", :locals => {:f => video_form}
@@ -56,14 +56,14 @@ SimpleForm.setup do |config|
56
56
  # config.label_class = nil
57
57
 
58
58
  # You can define the class to use on all forms. Default is simple_form.
59
- config.form_class = "simple_form"
59
+ config.form_class = "simple_form validate"
60
60
 
61
61
  # Whether attributes are required by default (or not). Default is true.
62
- config.required_by_default = false
62
+ config.required_by_default = true
63
63
 
64
64
  # Tell browsers whether to use default HTML5 validations (novalidate option).
65
65
  # Default is enabled.
66
- config.browser_validations = false
66
+ config.browser_validations = true
67
67
 
68
68
  # Determines whether HTML5 types (:email, :url, :search, :tel) and attributes
69
69
  # (e.g. required) are used or not. True by default.
@@ -5,6 +5,7 @@ class CreateIndices < ActiveRecord::Migration
5
5
  t.string :title
6
6
  t.string :slug
7
7
  t.string :page_title
8
+ t.integer :priority
8
9
  t.text :keywords
9
10
  t.text :page_description
10
11
  t.integer :owner_id
@@ -5,6 +5,8 @@ module Sbdevcore
5
5
  argument :app_name, :type => :string
6
6
 
7
7
  def remove_bs
8
+ puts "foo\n\n\n"
9
+ directory "config", "config", :force => true
8
10
  remove_file 'public/index.html'
9
11
  remove_file 'public/images/rails.png'
10
12
  remove_file 'app/views/layouts/application.html.erb'
@@ -12,7 +14,6 @@ module Sbdevcore
12
14
  end
13
15
 
14
16
  def database
15
- directory "config", "config", :force => true
16
17
  template 'database.yml', 'config/database.yml', :force => true
17
18
  rake "db:drop:all"
18
19
  rake "db:create"
@@ -26,7 +27,7 @@ module Sbdevcore
26
27
  def set_routes
27
28
  route "Sbdevcore::Routes.draw(self)"
28
29
  statics = <<-STR
29
- root :to => "indices#show", :id => (Index.find_by_name('home').id rescue 1)
30
+ root :to => "indices#show", :id => ('home')
30
31
  match "(:id)" => "indices#show"
31
32
  STR
32
33
  route statics
@@ -9,7 +9,6 @@ $side_bar-width: 0;
9
9
  $padding: 10px;
10
10
  $content-width: $window-width - $side_bar-width - 2*($shadow-radius) - 2*$padding;
11
11
  @import 'sbdev_core';
12
- @import 'bar_nav';
13
12
 
14
13
  body {
15
14
  background: url("/assets/background.jpg") repeat fixed center top $background-color;
data/lib/sbdevcore.rb CHANGED
@@ -14,7 +14,9 @@ module Sbdevcore
14
14
  resources :videos
15
15
  resources :downloadables
16
16
  resources :texts
17
- resources :galleries
17
+ resources :galleries do
18
+ resources :indices
19
+ end
18
20
 
19
21
  resources :indices do
20
22
  resources :photos
@@ -1,3 +1,3 @@
1
1
  module Sbdevcore
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
data/sbdevcore.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_dependency('tinymce-rails')
22
- s.add_dependency('prioritizable')
22
+ s.add_dependency('prioritizable', ">= 0.0.3")
23
23
  s.add_dependency('devise')
24
24
  s.add_dependency('paperclip')
25
25
  s.add_dependency('haml-edge')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbdevcore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-31 00:00:00.000000000Z
12
+ date: 2011-09-05 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tinymce-rails
16
- requirement: &2153469800 !ruby/object:Gem::Requirement
16
+ requirement: &2156854500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,21 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153469800
24
+ version_requirements: *2156854500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: prioritizable
27
- requirement: &2153469320 !ruby/object:Gem::Requirement
27
+ requirement: &2156854000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: 0.0.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153469320
35
+ version_requirements: *2156854000
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: devise
38
- requirement: &2153468800 !ruby/object:Gem::Requirement
38
+ requirement: &2156853520 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153468800
46
+ version_requirements: *2156853520
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: paperclip
49
- requirement: &2153468320 !ruby/object:Gem::Requirement
49
+ requirement: &2156853060 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2153468320
57
+ version_requirements: *2156853060
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: haml-edge
60
- requirement: &2153467880 !ruby/object:Gem::Requirement
60
+ requirement: &2156852620 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2153467880
68
+ version_requirements: *2156852620
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sitemap_generator
71
- requirement: &2153397660 !ruby/object:Gem::Requirement
71
+ requirement: &2156852200 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2153397660
79
+ version_requirements: *2156852200
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: hpricot
82
- requirement: &2153397140 !ruby/object:Gem::Requirement
82
+ requirement: &2156851760 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *2153397140
90
+ version_requirements: *2156851760
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: simple_form
93
- requirement: &2153396680 !ruby/object:Gem::Requirement
93
+ requirement: &2156851340 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *2153396680
101
+ version_requirements: *2156851340
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: client_side_validations
104
- requirement: &2153396140 !ruby/object:Gem::Requirement
104
+ requirement: &2156850900 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *2153396140
112
+ version_requirements: *2156850900
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: formalize-rails
115
- requirement: &2153395660 !ruby/object:Gem::Requirement
115
+ requirement: &2156850460 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *2153395660
123
+ version_requirements: *2156850460
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: will_paginate
126
- requirement: &2153395120 !ruby/object:Gem::Requirement
126
+ requirement: &2156849940 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 3.0.pre4
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *2153395120
134
+ version_requirements: *2156849940
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: aws-s3
137
- requirement: &2153394660 !ruby/object:Gem::Requirement
137
+ requirement: &2156849520 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *2153394660
145
+ version_requirements: *2156849520
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: rubyist-aasm
148
- requirement: &2153394080 !ruby/object:Gem::Requirement
148
+ requirement: &2156849060 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :runtime
155
155
  prerelease: false
156
- version_requirements: *2153394080
156
+ version_requirements: *2156849060
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: inherited_resources
159
- requirement: &2153393620 !ruby/object:Gem::Requirement
159
+ requirement: &2156848640 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: '0'
165
165
  type: :runtime
166
166
  prerelease: false
167
- version_requirements: *2153393620
167
+ version_requirements: *2156848640
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: friendly_id
170
- requirement: &2153393000 !ruby/object:Gem::Requirement
170
+ requirement: &2156848120 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ~>
@@ -175,7 +175,7 @@ dependencies:
175
175
  version: 4.0.0.beta8
176
176
  type: :runtime
177
177
  prerelease: false
178
- version_requirements: *2153393000
178
+ version_requirements: *2156848120
179
179
  description: Core
180
180
  email:
181
181
  - aosalias@gmail.com
@@ -273,6 +273,7 @@ files:
273
273
  - app/views/downloadables/edit.html.haml
274
274
  - app/views/downloadables/new.html.haml
275
275
  - app/views/galleries/_form.html.haml
276
+ - app/views/galleries/_show.html.haml
276
277
  - app/views/galleries/edit.html.haml
277
278
  - app/views/galleries/index.html.haml
278
279
  - app/views/galleries/new.html.haml
@@ -280,6 +281,7 @@ files:
280
281
  - app/views/indices/_form.html.haml
281
282
  - app/views/indices/_show.html.haml
282
283
  - app/views/indices/edit.html.haml
284
+ - app/views/indices/new.html.haml
283
285
  - app/views/indices/show.html.haml
284
286
  - app/views/layouts/application.html.haml
285
287
  - app/views/layouts/bar_nav.html.haml
@@ -316,7 +318,6 @@ files:
316
318
  - config.ru
317
319
  - config/initializers/client_side_validations.rb
318
320
  - config/initializers/custom_validators.rb
319
- - config/initializers/load_app_config.rb
320
321
  - config/initializers/simple_form.rb
321
322
  - config/locales/en.yml
322
323
  - db/migrate/20110125174343_create_contacts.rb
@@ -343,7 +344,6 @@ files:
343
344
  - lib/generators/sbdevcore/templates/config/initializers/devise.rb
344
345
  - lib/generators/sbdevcore/templates/config/initializers/load_app_config.rb
345
346
  - lib/generators/sbdevcore/templates/config/initializers/mailer_setup.rb
346
- - lib/generators/sbdevcore/templates/config/initializers/simple_form.rb
347
347
  - lib/generators/sbdevcore/templates/config/s3.yml
348
348
  - lib/generators/sbdevcore/templates/database.yml
349
349
  - lib/generators/sbdevcore/templates/new_contact.html.haml
@@ -1,2 +0,0 @@
1
- raw_config = File.read(Rails.root.join("config", "app_config.yml"))
2
- APP_CONFIG = (YAML.load(raw_config)[Rails.env].merge YAML.load(raw_config)['shared']).symbolize_keys
@@ -1,93 +0,0 @@
1
- # Use this setup block to configure all options available in SimpleForm.
2
- SimpleForm.setup do |config|
3
- # Components used by the form builder to generate a complete input. You can remove
4
- # any of them, change the order, or even add your own components to the stack.
5
- config.components = [ :placeholder, :label_input, :hint, :error ]
6
-
7
- # Default tag used on hints.
8
- # config.hint_tag = :span
9
-
10
- # CSS class to add to all hint tags.
11
- # config.hint_class = :hint
12
-
13
- # CSS class used on errors.
14
- # config.error_class = :error
15
-
16
- # Default tag used on errors.
17
- # config.error_tag = :span
18
-
19
- # Method used to tidy up errors.
20
- # config.error_method = :first
21
-
22
- # Default tag used for error notification helper.
23
- # config.error_notification_tag = :p
24
-
25
- # CSS class to add for error notification helper.
26
- # config.error_notification_class = :error_notification
27
-
28
- # ID to add for error notification helper.
29
- # config.error_notification_id = nil
30
-
31
- # You can wrap all inputs in a pre-defined tag.
32
- # config.wrapper_tag = :div
33
-
34
- # CSS class to add to all wrapper tags.
35
- # config.wrapper_class = :input
36
-
37
- # CSS class to add to the wrapper if the field has errors.
38
- # config.wrapper_error_class = :field_with_errors
39
-
40
- # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
41
- # config.collection_wrapper_tag = nil
42
-
43
- # You can wrap each item in a collection of radio/check boxes with a tag, defaulting to span.
44
- # config.item_wrapper_tag = :span
45
-
46
- # Series of attempts to detect a default label method for collection.
47
- # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
48
-
49
- # Series of attempts to detect a default value method for collection.
50
- # config.collection_value_methods = [ :id, :to_s ]
51
-
52
- # How the label text should be generated altogether with the required text.
53
- config.label_text = lambda { |label, required| "#{label} #{required}" }
54
-
55
- # You can define the class to use on all labels. Default is nil.
56
- # config.label_class = nil
57
-
58
- # You can define the class to use on all forms. Default is simple_form.
59
- config.form_class = "simple_form validate"
60
-
61
- # Whether attributes are required by default (or not). Default is true.
62
- config.required_by_default = true
63
-
64
- # Tell browsers whether to use default HTML5 validations (novalidate option).
65
- # Default is enabled.
66
- config.browser_validations = true
67
-
68
- # Determines whether HTML5 types (:email, :url, :search, :tel) and attributes
69
- # (e.g. required) are used or not. True by default.
70
- # Having this on in non-HTML5 compliant sites can cause odd behavior in
71
- # HTML5-aware browsers such as Chrome.
72
- # config.html5 = true
73
-
74
- # Custom mappings for input types. This should be a hash containing a regexp
75
- # to match as key, and the input type that will be used when the field name
76
- # matches the regexp as value.
77
- # config.input_mappings = { /count/ => :integer }
78
-
79
- # Collection of methods to detect if a file type was given.
80
- # config.file_methods = [ :mounted_as, :file?, :public_filename ]
81
-
82
- # Default priority for time_zone inputs.
83
- # config.time_zone_priority = nil
84
-
85
- # Default priority for country inputs.
86
- # config.country_priority = nil
87
-
88
- # Default size for text inputs.
89
- config.default_input_size = 50
90
-
91
- # When false, do not use translations for labels, hints or placeholders.
92
- config.translate = true
93
- end