sbdevcore 0.2.0 → 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.
@@ -93,10 +93,10 @@ function add_nested(link, association, content, hide) {
93
93
  }
94
94
 
95
95
  function set_currents(){
96
- $('#nav [href="'+window.location.pathname.match(/\/\w*/i)+'"]').addClass("current");
97
- $('#nav [href="'+window.location.pathname+'"]').addClass("current");
96
+ $('[href="'+window.location.pathname.match(/\/\w*/i)+'"]').addClass("current");
97
+ $('[href="'+window.location.pathname+'"]').addClass("current");
98
98
  if(window.location.pathname === '/') {
99
- $('#nav [href="/home"]').addClass("current");
99
+ $('[href="/home"]').addClass("current");
100
100
  }
101
101
  }
102
102
 
@@ -156,11 +156,11 @@ function bind_functions(context){
156
156
  $(".scrollable", context).scrollable();
157
157
  paginateAjax(context);
158
158
  $(".items", context).tabs("#gallery_wrap div", {effect: 'myAjax', history: true, rotate: true}).slideshow({clickable: false, history: true});
159
+ set_currents();
159
160
  }
160
161
 
161
162
  $(document).ready(function (){
162
163
  bind_functions(document);
163
164
  init_tinymce();
164
- set_currents();
165
165
  });
166
166
 
@@ -10,5 +10,8 @@
10
10
  //= require tiny_mce_config.js
11
11
  //= require jquery.formalize
12
12
  //= require tinymce.jquery
13
+ //= require history.adapter.jquery
14
+ //= require history
15
+ //= require history.html4
13
16
  //= require sbdev-ajax.js
14
17
  //= require sbdevcore-tools.js
@@ -1,9 +1,4 @@
1
1
  /*Buttons*/
2
- .nav .button {
3
- width: 210px;
4
- padding: 5px 0 !important;
5
- }
6
-
7
2
  img.button {
8
3
  border: none;
9
4
  }
@@ -63,6 +63,29 @@
63
63
  behavior: url(/stylesheets/PIE.htc);
64
64
  }
65
65
 
66
+ @mixin corners-right($radius) {
67
+ -moz-border-radius-topright: $radius;
68
+ -webkit-border-top-right-radius: $radius;
69
+ border-top-right-radius: $radius;
70
+ -moz-border-radius-bottomright: $radius;
71
+ -webkit-border-bottom-right-radius: $radius;
72
+ border-bottom-right-radius: $radius;
73
+
74
+ behavior: url(/stylesheets/PIE.htc);
75
+ }
76
+
77
+ @mixin corners-left($radius) {
78
+ @include corners-all(0);
79
+ -moz-border-radius-topleft: $radius;
80
+ -webkit-border-top-left-radius: $radius;
81
+ border-top-left-radius: $radius;
82
+ -moz-border-radius-bottomleft: $radius;
83
+ -webkit-border-bottom-left-radius: $radius;
84
+ border-bottom-left-radius: $radius;
85
+
86
+ behavior: url(/stylesheets/PIE.htc);
87
+ }
88
+
66
89
  @mixin arrow-up($size, $color){
67
90
  width: 0;
68
91
  height: 0;
File without changes
@@ -47,14 +47,42 @@ body {
47
47
  }
48
48
 
49
49
  #main {
50
- width: 75%;
51
- float: left;
50
+ // float: left;
52
51
  }
53
52
 
54
- #side_bar {
55
- width: 24%;
56
- float: left;
53
+ #sidebar {
54
+ width: 30%;
55
+ float: right;
56
+ background-color: $content-background-color;
57
57
  border-left: 1px dashed silver;
58
+ #secondary_nav {
59
+ .button {
60
+ position: relative;
61
+ width: 90%;
62
+ padding-right: 20px;
63
+ @include corners-left($corner-radius);
64
+ float: right;
65
+ right: -20px;
66
+ @include box-shadow(0);
67
+ }
68
+ .secondary {
69
+ width: 88%;
70
+ border-top: 1px dashed silver;
71
+ @include corners-all(0);
72
+ }
73
+ }
74
+ }
75
+
76
+ .title {
77
+ width: 67%;
78
+ background-color: $button-background-color;
79
+ padding: 10px;
80
+ padding-left: 20px;
81
+ margin: 0;
82
+ color: $content-background-color;
83
+ position: relative;
84
+ left: -10px;
85
+ @include corners-right($corner-radius);
58
86
  }
59
87
 
60
88
  .content {
@@ -181,6 +209,10 @@ form {
181
209
  border: solid 1px #C66;
182
210
  }
183
211
 
212
+ #flash_notice, #flash_error{
213
+ margin: 10px;
214
+ }
215
+
184
216
  .fieldWithErrors {
185
217
  display: inline;
186
218
  }
@@ -226,7 +258,12 @@ td {
226
258
 
227
259
  .ajax-loader {
228
260
  background: url('/assets/ajax-loader.gif') center center no-repeat;
229
- * {
230
- opacity: .5;
261
+ z-index: 1;
262
+ *{
263
+ opacity: .8;
231
264
  }
265
+ }
266
+
267
+ .hidden {
268
+ display: none;
232
269
  }
@@ -8,6 +8,10 @@ class SbdevCoreController < InheritedResources::Base
8
8
 
9
9
  layout "application"
10
10
 
11
+ def index
12
+ index!(:layout => !request.xhr?)
13
+ end
14
+
11
15
  def show
12
16
  show!(:layout => !request.xhr?)
13
17
  end
@@ -0,0 +1,11 @@
1
+ # These helper methods can be called in your template to set variables to be used in the layout
2
+ # This module should be included in all views globally,
3
+ # to do so you may need to add this line to your ApplicationController
4
+ # helper :layout
5
+ module SbdevCoreHelper
6
+ def render_seo(index)
7
+ content_for(:title, index.try("page_title"))
8
+ content_for(:keywords, index.try("keywords"))
9
+ content_for(:page_description, index.try("page_description"))
10
+ end
11
+ end
data/app/models/photo.rb CHANGED
@@ -7,6 +7,8 @@ class Photo < ActiveRecord::Base
7
7
  include ActsAsPrioritizable
8
8
  acts_as_prioritizable("index", "assets")
9
9
 
10
+ after_initialize :defaults
11
+
10
12
  has_attached_file :asset,
11
13
  :styles => {
12
14
  :original => "1000>",
@@ -54,4 +56,8 @@ class Photo < ActiveRecord::Base
54
56
  filename = asset_file_name.gsub(/\.#{extension}$/, '')
55
57
  self.asset.instance_write(:file_name, "#{transliterate(filename)}.#{transliterate(extension)}")
56
58
  end
59
+
60
+ def defaults
61
+ self.klass ||= "center"
62
+ end
57
63
  end
@@ -1,3 +1,4 @@
1
1
  #secondary_nav
2
- -obj.indices.each do |page|
3
- = link_to page.title, page.title, :class => 'button', :remote => true, :rel => '#main'
2
+ = link_to @index.title.titleize, collection_url, :class => 'button current', :remote => true
3
+ -collection.each do |page|
4
+ = link_to page.index.title.titleize, page, :class => 'button secondary', :remote => true
@@ -1,9 +1,8 @@
1
- -logger.info local_assigns
2
1
  - index ||= local_assigns[:index]
3
2
  - render_seo index
4
3
  %div{:id => "index#{index.id}"}
5
- %h2.title=index.title.titleize
6
- .clearfix= render :partial => 'shared/asset_show', :collection => index.assets, :as => :asset
4
+ %h1.title=index.title.titleize
5
+ = render :partial => 'shared/asset_show', :collection => index.assets, :as => :asset
7
6
  - if admin_signed_in?
8
7
  .asset
9
8
  %p.asset-admin
@@ -15,3 +14,11 @@
15
14
  - content_for :post_content do
16
15
  .content.corner-all.box-shadow
17
16
  = render :partial => "shared/gallery", :locals => {:objs => index.gallery.assets}
17
+ - if request.xhr?
18
+ .content_for.hidden
19
+ #content_for_title
20
+ =@view_flow.get(:title)
21
+ #content_for_keywords
22
+ =@view_flow.get(:keywords)
23
+ #content_for_page_description
24
+ =@view_flow.get(:page_description)
@@ -0,0 +1,12 @@
1
+ =content_for(:sidebar) do
2
+ #secondary_nav
3
+ - nav = resource.owner.nil? ? resource : resource.owner
4
+ = link_to nav.title.titleize, nav.title, :class => 'button current', :remote => true
5
+ -nav.indices.each do |page|
6
+ = link_to page.title.titleize, page.name, :class => 'button secondary', :remote => true
7
+
8
+ =(render :partial => 'show', :object => resource, :as => resource_class.to_s.downcase.to_sym)
9
+ - if request.xhr?
10
+ .content_for.hidden
11
+ #content_for_sidebar
12
+ =@view_flow.get(:sidebar)
@@ -1,8 +1,8 @@
1
1
  %html(xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en")
2
2
  %head
3
- %title=yield(:title) || APP_CONFIG[:app_name]
4
- %meta{:name => 'description', :content => "#{(yield(:description) || APP_CONFIG[:app_name])}"}
5
- %meta{:name => 'keywords', :content => "#{(yield(:keywords) || APP_CONFIG[:app_name])}"}
3
+ %title=yield(:title)
4
+ %meta{:name => 'description', :content => yield(:description)}
5
+ %meta{:name => 'keywords', :content => yield(:keywords)}
6
6
  = stylesheet_link_tag 'application'
7
7
  = javascript_include_tag 'application'
8
8
  = csrf_meta_tag
@@ -14,13 +14,13 @@
14
14
  #container
15
15
  #main_container
16
16
  = render 'application/nav'
17
+ - flash.each do |name, msg|
18
+ = content_tag :div, msg, :id => "flash_#{name}"
17
19
  .content.clearfix
18
- #main
19
- - flash.each do |name, msg|
20
- = content_tag :div, msg, :id => "flash_#{name}"
21
- = yield
22
20
  #sidebar
23
21
  = yield(:sidebar)
22
+ #main
23
+ = yield
24
24
  = render 'application/footer'
25
25
  #overlay.overlay
26
26
  .contentWrap
@@ -2,9 +2,9 @@
2
2
  - f ||= local_assigns[:locals][:f]
3
3
  %div{:id => f.object.id.to_s}
4
4
  - if f.object.asset_file_name
5
- = image_tag f.object.asset.url(:thumb), :width => "100"
5
+ = image_tag f.object.asset.url(:thumb), :width => "100", :class => "left"
6
6
  = f.input :name
7
- = f.input :asset, :required => (f.object.asset_file_name.blank? ? true : false), :as => :file, :label => "Photo"
7
+ = f.input :asset, :as => :file, :label => "Photo", :input_html => {:validate => ( f.object.asset_file_name.blank? ? true : false) }
8
8
  = f.input :description, :input_html => { :cols => 70, :rows => 3 }
9
9
  = f.input :klass, :as => :radio, :collection => ["left", "right", "center"], :label => "Alignment"
10
10
  = render "shared/prioritizable_fields", :locals => {:f => f}
@@ -1 +1,8 @@
1
- = render :partial => 'indices/show', :object => @index, :as => :index
1
+ =content_for(:sidebar) do
2
+ =render :partial => "application/secondary_nav", :collection => collection
3
+
4
+ =(render :partial => 'indices/show', :object => @index, :as => :index)
5
+ - if request.xhr?
6
+ .content_for.hidden
7
+ #content_for_sidebar
8
+ =@view_flow.get(:sidebar)
@@ -1,4 +1,2 @@
1
- =content_for(:sidebar) do
2
- =render :partial => "application/secondary_nav", :object => resource, :as => :obj
3
-
4
1
  =(render :partial => 'show', :object => resource, :as => resource_class.to_s.downcase.to_sym)
2
+ =(render :partial => 'indices/show', :object => resource.index, :as => :index)
@@ -2,4 +2,4 @@
2
2
  - if(f.object.prioritizables.empty? rescue true)
3
3
  = f.hidden_field :priority
4
4
  - else
5
- = f.input :priority, :as => :select, :collection => (f.object.prioritizables.each_with_index.map{|p,i| [(i+1).ordinalize, p.priority]} + [['Last',f.object.lowest_priority+1]]), :include_blank => false
5
+ = f.input :priority, :collection => (f.object.prioritizables.each_with_index.map{|p,i| [(i+1).ordinalize, p.priority]} + [['Last',f.object.lowest_priority+1]]), :include_blank => false
@@ -3,7 +3,7 @@ class CreatePhotos < ActiveRecord::Migration
3
3
  create_table :photos do |t|
4
4
  t.string :name
5
5
  t.text :description
6
- t.string :klass
6
+ t.string :klass, :default => "center"
7
7
  t.string :asset_file_name
8
8
  t.string :asset_content_type
9
9
  t.integer :asset_file_size
data/db/seeds.rb CHANGED
@@ -36,9 +36,9 @@ Index.all.each(&:destroy)
36
36
  [statics + dynamics].flatten.each do |index|
37
37
  attr = {
38
38
  :name => index,
39
- :title => index,
40
- :page_title => APP_CONFIG[:app_name] + " - " + index.capitalize,
41
- :page_description => APP_CONFIG[:app_name] + " - " + index.capitalize,
39
+ :title => index.titleize,
40
+ :page_title => APP_CONFIG[:app_name] + " - " + index.titleize,
41
+ :page_description => APP_CONFIG[:app_name] + " - " + index.titleize,
42
42
  :keywords => index,
43
43
  :texts_attributes => {
44
44
  (id += 1).to_s =>{
@@ -55,9 +55,9 @@ statics.each do |index|
55
55
  sub_index = index + "_#{i.to_s}"
56
56
  attr = {
57
57
  :name => sub_index,
58
- :title => sub_index,
59
- :page_title => APP_CONFIG[:app_name] + " - " + sub_index.capitalize,
60
- :page_description => APP_CONFIG[:app_name] + " - " + sub_index.capitalize,
58
+ :title => sub_index.titleize,
59
+ :page_title => APP_CONFIG[:app_name] + " - " + sub_index.titleize,
60
+ :page_description => APP_CONFIG[:app_name] + " - " + sub_index.titleize,
61
61
  :keywords => sub_index,
62
62
  :texts_attributes => {
63
63
  (id += 1).to_s =>{
@@ -26,10 +26,8 @@ module Sbdevcore
26
26
  def set_routes
27
27
  route "Sbdevcore::Routes.draw(self)"
28
28
  statics = <<-STR
29
- Index.find_all_by_name(APP_CONFIG[:static_pages]).each do |page|
30
- match page.name => "indices#show", :id => page.id, :as => page.name.to_sym
31
- end rescue true
32
29
  root :to => "indices#show", :id => (Index.find_by_name('home').id rescue 1)
30
+ match "(:id)" => "indices#show"
33
31
  STR
34
32
  route statics
35
33
  end
@@ -1,4 +1,4 @@
1
1
  #nav
2
- =link_to 'Home', home_path, :class => 'button'
3
- =link_to 'About', about_path, :class => 'button'
2
+ =link_to 'Home', "/home", :class => 'button'
3
+ =link_to 'About', "/about", :class => 'button'
4
4
  =link_to 'Contact', new_contact_path, :class => 'button', :rel=>"#overlay"
@@ -1,3 +1,3 @@
1
1
  module Sbdevcore
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end