mcms_pages 0.0.4 → 0.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.
Binary file
@@ -13,7 +13,7 @@ $(document).ready(function(){
13
13
 
14
14
  //assigning DOM element in a variable
15
15
  var treeElement = $('.pages-tree .page-toggle');
16
- var textBox = $('#page_link_url');
16
+ var textBox = $('#page_link_url');
17
17
 
18
18
  /*
19
19
  * @params : None
@@ -2,15 +2,170 @@
2
2
  // They will automatically be included in application.css.
3
3
  // You can use Sass (SCSS) here: http://sass-lang.com/
4
4
 
5
- .layout-images{
6
5
 
7
- float:left;
8
- padding: 0px;
9
- margin-left: 40px;
10
- margin-bottom: 100px;
6
+ .layouts{
7
+
8
+ text-align: left;
9
+
10
+ }
11
+
12
+ .layout-preview{
13
+ background-color: gray;
14
+ border: 1px dashed yellow;
15
+ width: 1000px;
16
+ height: 450px;
17
+ margin: auto;
18
+ text-transform: capitalize;
19
+ word-wrap: break-word;
11
20
  position: relative;
12
- height: 100%;
21
+ }
22
+
23
+ .preview-center {
24
+
25
+ min-width: 280px;
26
+ padding: 115px 250px;
27
+
28
+ }
29
+
30
+ .preview-right {
31
+
32
+ border-left: 1px dashed red;
33
+ position: absolute;
34
+ right: 0px;
35
+ top: 0;
36
+ height: 220px;
37
+ width: 200px;
38
+ padding: 115px 15px;
39
+ }
40
+
41
+ .preview-left {
42
+
43
+ border-right: 1px dashed red;
44
+ position: absolute;
45
+ left: 0px;
46
+ top: 0px;
47
+ height: 220px;
48
+ width: 200px;
49
+ padding: 115px 15px;
50
+ }
51
+
52
+ .preview-header {
53
+
54
+ border-bottom: 1px dashed red;
55
+ height: 30px;
56
+ width: 1000px;
57
+ position: absolute;
58
+ text-align: center;
59
+ top: 0px;
60
+ padding: 25px 0;
61
+
62
+ }
63
+
64
+ .preview-footer {
65
+
66
+ border-top: 1px dashed red;
67
+ position: absolute;
68
+ bottom: 0px;
69
+ height: 30px;
70
+ width: 1000px;
71
+ padding: 25px 0;
13
72
  text-align: center;
14
- border: 1px solid cyan;
73
+ }
74
+
75
+ .layout-preview.with-left {
76
+
77
+ .preview-center {
78
+ min-width: 280px;
79
+ min-height: 320px;
80
+ padding: 115px 20px 80px 250px;
81
+ }
82
+ }
83
+
84
+ .layout-preview.with-right {
85
+
86
+ .preview-center {
87
+ min-width: 280px;
88
+ min-height: 320px;
89
+ padding: 115px 250px 80px 20px;
90
+ }
91
+ }
92
+
93
+ .layout-preview.with-header {
94
+
95
+ .preview-center {
96
+ min-width: 280px;
97
+ min-height: 320px;
98
+ padding: 140px 250px;
99
+ }
100
+
101
+ .preview-right, .preview-left {
102
+
103
+ height: 250px;
104
+ top: 80px;
105
+ padding: 60px 15px;
106
+ }
107
+
108
+ }
109
+
110
+ .layout-preview.with-footer {
111
+
112
+ .preview-center {
113
+ min-width: 280px;
114
+ min-height: 320px;
115
+ padding: 80px 250px;
116
+ }
117
+
118
+ .preview-right, .preview-left {
119
+
120
+ height: 210px;
121
+ top: 0;
122
+ bottom: 80px;
123
+ padding: 80px 15px;
124
+ }
125
+
126
+ }
127
+
128
+ .layout-preview.with-footer.with-header {
129
+
130
+ .preview-center {
131
+
132
+ min-height: 240px;
133
+ min-width: 280px;
134
+ padding: 115px 250px;
135
+
136
+ }
137
+
138
+ .preview-right {
139
+
140
+ border-left: 1px dashed red;
141
+ position: absolute;
142
+ right: 0px;
143
+ top: 80px;
144
+ height: 255px;
145
+ width: 200px;
146
+ padding: 35px 10px 0;
147
+ }
148
+
149
+ .preview-left {
150
+
151
+ border-right: 1px dashed red;
152
+ position: absolute;
153
+ left: 0px;
154
+ top: 80px;
155
+ height: 255px;
156
+ width: 200px;
157
+ padding: 35px 10px 0;
158
+ }
159
+
160
+ }
161
+
162
+
163
+
164
+ .button-go {
165
+
166
+ margin-top: 20px;
167
+ margin-left: 580px;
168
+ position: relative;
169
+
15
170
  }
16
171
 
@@ -67,6 +67,7 @@
67
67
  text-align: center;
68
68
  min-height:350px;
69
69
  float:left;
70
+ margin-right: 15px;
70
71
  }
71
72
 
72
73
  .page-main-body{
@@ -84,7 +85,7 @@
84
85
  width: 27%;
85
86
  text-align: center;
86
87
  min-height:350px;
87
- float: left;
88
+ float: right;
88
89
  }
89
90
 
90
91
  .pages-menu {
@@ -148,25 +149,26 @@
148
149
  background-color: #8db3ff;
149
150
  }
150
151
 
151
- #default-page-main-body, #one-column-main-body {
152
+ #default-main-body, #one-column-main-body {
152
153
  width: 99%;
153
- text-align: left;
154
+ text-align: justify;
154
155
  }
155
156
  #two-column-main-body {
156
157
  width: 70%;
157
- text-align: left;
158
+ text-align: justify;
158
159
  }
159
160
  #three-column-main-body {
160
161
  width: 50%;
161
- text-align: left;
162
+ text-align: justify;
162
163
  }
163
164
  #two-column-left-body, #two-column-right-body {
164
165
  width: 28%;
165
- text-align: left;
166
+ text-align: justify;
167
+ margin-right: 5px;
166
168
  }
167
169
 
168
170
  #three-column-left-body, #three-column-right-body {
169
- width: 20%;
170
- text-align: left;
171
+ width: 23%;
172
+ text-align: justify;
171
173
  }
172
174
 
@@ -12,6 +12,9 @@
12
12
 
13
13
  class Admin::LayoutsController < AdminController
14
14
 
15
+ #includes helper file
16
+ include PagesHelper
17
+
15
18
  before_filter :load_assets
16
19
 
17
20
  # GET /layouts
@@ -29,12 +32,61 @@ class Admin::LayoutsController < AdminController
29
32
 
30
33
  # send data in different format
31
34
  respond_to do |format|
35
+
32
36
  format.html{render :template => 'mcms_pages/admin/layouts/index'}# index.html.erb
33
37
  format.json { render json: @pages }
38
+
34
39
  end # end respond_to
35
40
 
36
41
  end # end action
37
42
 
43
+ # @params : Array(via GET)
44
+ # @returns : None
45
+ # purpose : To find layout id and redirect to new page path with layout id as param
46
+ def find_and_use_layout
47
+
48
+ # declare a local variable with default value
49
+ query_string = "1"
50
+
51
+ # initializing a local variable with default value false
52
+ value = false
53
+
54
+ # spliting the get params and assigning it to an array
55
+ url_param = params[:layout].split(",")
56
+
57
+ # looping through all possible layout parts
58
+ layout_parts.each do |layout|
59
+
60
+ if url_param.include?(layout)
61
+
62
+ value = true
63
+
64
+ end # end if
65
+
66
+ # check and change string to match column name
67
+ if layout == "left"
68
+
69
+ layout = "lft"
70
+
71
+ elsif layout == "right"
72
+
73
+ layout = "rgt"
74
+
75
+ end # end if
76
+
77
+ query_string += " AND `" + layout +"` = " + value.to_s
78
+
79
+
80
+ end # end loop
81
+
82
+ # find layout id from query string
83
+ layout_id = Layout.where(query_string).first.id
84
+
85
+ # redirect to new page path with params layout id
86
+ redirect_to new_admin_page_path(:layout_id => layout_id)
87
+
88
+ end # end action
89
+
38
90
  #defining controller specific method as protected
39
91
  protected
40
92
 
@@ -44,8 +96,10 @@ class Admin::LayoutsController < AdminController
44
96
  # class method call to include css files
45
97
  Asset.include_css ["mcms_pages/layout"]
46
98
 
47
- end # end method
99
+ # class method call to include js files
100
+ Asset.include_local_library [:application]
48
101
 
102
+ end # end method
49
103
 
50
104
  end # end class
51
105
 
@@ -28,7 +28,7 @@ class PagesController < ApplicationController
28
28
  # send data in different format
29
29
  respond_to do |format|
30
30
 
31
- format.html{ render :template => 'mcms_pages/pages/home'}# home.html.erb
31
+ format.html{ render :template => 'mcms_pages/pages/show'}# home.html.erb
32
32
  format.json { render json: @page }
33
33
 
34
34
  end # end respond_to block
@@ -22,19 +22,19 @@ module PagesHelper
22
22
 
23
23
  when 2
24
24
 
25
- return "two_column_layout"
25
+ return "two-column"
26
26
 
27
27
  when 3
28
28
 
29
- return "three_column_layout"
29
+ return "three-column"
30
30
 
31
31
  when 1
32
32
 
33
- return "one_column_layout"
33
+ return "one-column"
34
34
 
35
35
  else
36
36
 
37
- return "default_layout"
37
+ return "default"
38
38
 
39
39
  end # end case statement
40
40
 
@@ -122,5 +122,16 @@ module PagesHelper
122
122
 
123
123
  end # end method
124
124
 
125
+ # @param : None
126
+ # @return : Hash
127
+ # @purpose : To return hash of all possible layout parts
128
+ def layout_parts
129
+
130
+ layout_parts = ["header","footer","left","right","main"]
131
+
132
+ layout_parts
133
+
134
+ end # end method
135
+
125
136
  end # end module
126
137
 
data/app/models/layout.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  @Creator Name : Vikram Kumar Mishra
6
6
  @Date Created : 2012-06-04
7
7
  @Date Modified : 2012-06-15
8
- @Last Modification Details :
8
+ @Last Modification Details :
9
9
  @Purpose : To deal with database table "mcms_layouts" and all operations related to that table mainly.
10
10
  It may deal with other tables and DB related operations.
11
11
  =end
@@ -18,7 +18,7 @@ class Layout < ActiveRecord::Base
18
18
  self.table_name = "mcms_layouts"
19
19
 
20
20
  #definig the list of accessible attributes as required by rails
21
- attr_accessible :column_count, :left, :main, :name, :right, :header, :footer
21
+ attr_accessible :column_count, :lft, :main, :name, :rgt, :header, :footer
22
22
 
23
23
  #Associating table "mcms_pages" with table "mcms_page_parts" using has_many relation
24
24
  has_many :pages,
@@ -52,13 +52,14 @@ class Layout < ActiveRecord::Base
52
52
  # true in DB
53
53
  page_part_array << "header" if layout["header"]
54
54
  page_part_array << "footer" if layout["footer"]
55
- page_part_array << "left body" if layout["left"]
56
- page_part_array << "right body" if layout["right"]
55
+ page_part_array << "left body" if layout["lft"]
56
+ page_part_array << "right body" if layout["rgt"]
57
57
  page_part_array << "main body" if layout["main"]
58
58
 
59
59
  # return the array
60
60
  return page_part_array
61
61
 
62
62
  end # end method
63
-
63
+
64
64
  end # end class
65
+
@@ -0,0 +1,128 @@
1
+ <!--
2
+
3
+ @File Name : layouts/_index.js.erb
4
+ @Company Name : Mindfire Solutions Private Limited
5
+ @Creator Name : Vikram Kumar Mishra
6
+ @Date Created : 2012-08-20
7
+ @Date Modified :
8
+ @Last Modification Details :
9
+ @Purpose : To show the page preview on click of preview submit button.
10
+
11
+ -->
12
+
13
+ <script type="text/javascript">
14
+
15
+ $(document).ready(function(){
16
+
17
+ //creating an empty array to store all checked elements
18
+ var layout = ["main"];
19
+
20
+ //assigning DOM element checkbox in a variable
21
+ var eltCheckbox = $('.layout-select');
22
+ var btnGo = $('#layout-select-button');
23
+
24
+ var demoContent = $(".preview-center").html();
25
+
26
+ /*
27
+ * @params : None
28
+ * @return : None
29
+ * @purpose : initializing the functions call to bind events with DOM element
30
+ */
31
+ var initialize = function(){
32
+
33
+ //function call to show layout preview on change of checkbox selection
34
+ eltCheckbox.change(boxPreviewLayout);
35
+
36
+ //function call to show layout preview on change of checkbox selection
37
+ btnGo.click(redirectToFindLayout);
38
+
39
+ } // end initialize function
40
+
41
+ /*
42
+ * @params : None
43
+ * @return : None
44
+ * @purpose : making the layout preview div empty and calling the function to show the layout preview
45
+ */
46
+ var boxPreviewLayout = function(){
47
+
48
+ $('.layout-preview').html('');
49
+
50
+ $('.layout-preview').removeClass('with-header with-footer');
51
+
52
+ //function call to loop through each checked element and show the preview layout for selected parts
53
+ previewLayout();
54
+
55
+ } // end boxPreviewLayout function for checkboxes
56
+
57
+ /*
58
+ * @params : None
59
+ * @return : None
60
+ * @purpose : showing the preview of page layout on select of checkboxes
61
+ */
62
+ var previewLayout = function(){
63
+
64
+ var i = 1;
65
+
66
+ //loop through each selected checkboxes
67
+ $('.layout-select:checked').each(function(){
68
+
69
+
70
+ //add class with-header if header is selected
71
+ if($(this).val() == 'header')
72
+ {
73
+
74
+ $('.layout-preview').addClass('with-header');
75
+
76
+ }
77
+ else if($(this).val() == 'footer') //add class with-footer if footer is selected
78
+ {
79
+
80
+ $('.layout-preview').addClass('with-footer');
81
+
82
+ }
83
+
84
+ if($(this).val() == "left" || $(this).val() == "right")
85
+ {
86
+
87
+ //append required div based on checkbox selected
88
+ $('.layout-preview').append('<div class="preview-'+$(this).val()+'">'+demoContent.substring(0,demoContent.indexOf('</p>')+4)+'</div>');
89
+
90
+ }
91
+ else
92
+ {
93
+
94
+ //append required div based on checkbox selected
95
+ $('.layout-preview').append('<div class="preview-'+$(this).val()+'">'+$(this).val()+' Area</div>');
96
+
97
+ } // end if
98
+
99
+ //assign current layout element to an array
100
+ layout[i] = $(this).val();
101
+
102
+ //increase the index by 1
103
+ i = i+1;
104
+
105
+ }); // end each function for checkboxes
106
+
107
+ // append default center div
108
+ $('.layout-preview').append('<div class="preview-center">'+demoContent+'</div>');
109
+
110
+ } // end previewLayout function
111
+
112
+ /*
113
+ * @params : None
114
+ * @return : None
115
+ * @purpose : To redirect to the rails action to find and use layout
116
+ */
117
+ var redirectToFindLayout = function(){
118
+
119
+ window.location = "/mcms/layouts/find_and_use_layout?layout="+layout;
120
+
121
+ }
122
+
123
+ //calling initialize function
124
+ initialize();
125
+
126
+ }); // end ready function
127
+
128
+ </script>
@@ -10,50 +10,72 @@
10
10
 
11
11
  -->
12
12
 
13
- <h3> Click on the Image you want to choose as layout </h3>
13
+ <h3> Check all the checkboxes which you want to appear on your page </h3>
14
14
 
15
- <div id="layout-images-div">
15
+ <% loop_count = 1 %>
16
16
 
17
- <!--
18
- looping through all the elements of @layouts array to
19
- show preview images for all layouts
20
- -->
21
- <% @layouts.each do |layout| %>
17
+ <div class="layouts">
22
18
 
23
- <div class="layout-images">
19
+ <% layout_parts.each do |layout_part| %>
24
20
 
25
- <div class="layout-name">
21
+ <% if layout_part == "main" %>
26
22
 
27
- <%= layout.name %>
23
+ <%= check_box_tag 'layout-center', layout_part, false, :multitple => true, :disabled => true,
24
+ :id => "layout-select-#{loop_count}", :checked => true, :readonly => true %>
28
25
 
29
- </div>
30
- <div class="layout-image">
26
+ <%= "center".capitalize %>
31
27
 
32
- <%= image_tag("layouts/#{layout.name.tr(' ', '-')}.png", :size => "400x400",
33
- :alt => "#{layout.name}", :title => "click to view large") %>
28
+ <% else %>
34
29
 
35
- </div>
36
- <div class="layout-link">
30
+ <%= check_box_tag 'layout[]', layout_part, false, :multitple => true,
31
+ :id => "layout-select-#{loop_count}", :class => "layout-select"%>
37
32
 
38
- <!-- if parent_id is not 0 then send parent_id through url -->
39
- <% if not @page_parent_id == 0 %>
33
+ <%= layout_part.capitalize %>
40
34
 
41
- <%= link_to("Use This Layout", new_admin_page_path(:layout_id => "#{layout.id}", :parent_id => "#{@page_parent_id}")) %>
35
+ <% end %>
42
36
 
43
- <% else %>
37
+ <% loop_count = loop_count+1 %>
44
38
 
45
- <%= link_to("Use This Layout", new_admin_page_path(:layout_id => "#{layout.id}")) %>
39
+ <% end %>
40
+
41
+ <p>
42
+
43
+ <h4> Below is a sample of how your page will look like.</h4>
44
+
45
+ </p>
46
+
47
+ <div class="layout-preview">
48
+
49
+ <div class="preview-center">
50
+
51
+ <p>
46
52
 
47
- <% end %>
53
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
54
+ Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non,
55
+ facilisis vitae, nulla.
48
56
 
49
- </div>
57
+ </p>
58
+ <p>
59
+
60
+ Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque,
61
+ sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim.
62
+ Sed tortor. Curabitur molestie.
63
+
64
+ </p>
50
65
 
51
66
  </div>
52
67
 
53
- <% end %>
68
+ </div>
69
+
70
+ <div class="button-go">
71
+
72
+ <%= button_tag "Use This Layout", :class => "button new-repo" , :id => "layout-select-button" %>
73
+
74
+ </div>
54
75
 
55
76
  </div>
56
77
 
78
+ <%= render "mcms_pages/admin/layouts/index.js" %>
57
79
  <!-- render partial _head.html.erb to include JS and CSS for specific page-->
58
80
  <%= render :partial => "mcms_pages/layouts/head" %>
59
81
 
@@ -9,13 +9,17 @@
9
9
 
10
10
  -->
11
11
 
12
- <% if p.nil? %>
12
+ <div class="page-<%= side %>-body" id="<%= layout %>-<%= side %>-body">
13
13
 
14
- <p style="color:red;font-weight:bold;">Please Create the body of the Page, You have not created it yet.</p>
14
+ <% if p.nil? %>
15
15
 
16
- <% else %>
16
+ <p style="color:red;font-weight:bold;">Please Create the body of the Page, You have not created it yet.</p>
17
17
 
18
- <%= p.body.html_safe %>
18
+ <% else %>
19
19
 
20
- <% end %>
20
+ <%= p.body.html_safe %>
21
+
22
+ <% end %>
23
+
24
+ </div>
21
25
 
@@ -9,35 +9,29 @@
9
9
 
10
10
  -->
11
11
 
12
- <!-- calling helper method to arrange page part of a page -->
13
12
  <% page = arrange_page_part(@page) %>
14
13
 
15
- <% if @page.layout.name == "default" %>
14
+ <!-- render partial for header -->
15
+ <%= render :partial => 'mcms_pages/layouts/header', :locals => {:p => page["header"]} unless page["header"].nil? %>
16
16
 
17
- <!-- render menu page -->
18
- <%= render :partial => 'mcms_pages/pages/menu' if not @page.link_url == '\404' %>
17
+ <!-- render menu page -->
18
+ <%= render :partial => 'mcms_pages/pages/menu' if not @page.link_url == '\404' %>
19
19
 
20
- <div id="default-page-main-body" class="page-main-body">
20
+ <!-- render partial _main_body.html.erb -->
21
+ <%=
22
+ render "mcms_pages/pages/main_body", :p => page["left body"], :side => "left", :layout => layout_name(@page.layout.column_count) unless page["left body"].nil?
23
+ %>
21
24
 
22
- <%= render :partial => "mcms_pages/pages/main_body", :locals => {:p => page["main body"]} %>
25
+ <!-- render partial _main_body.html.erb -->
26
+ <%=
27
+ render "mcms_pages/pages/main_body", :p => page["right body"], :side => "right", :layout => layout_name(@page.layout.column_count) unless page["right body"].nil?
28
+ %>
23
29
 
24
- </div>
30
+ <!-- render partial _main_body.html.erb -->
31
+ <%=
32
+ render "mcms_pages/pages/main_body", :p => page["main body"], :side => "main", :layout => layout_name(@page.layout.column_count) unless page["main body"].nil?
33
+ %>
25
34
 
26
- <% else %>
27
-
28
- <!-- render partial for header -->
29
- <%= render :partial => 'mcms_pages/layouts/header', :locals => {:p => page["header"]} %>
30
-
31
- <!-- render menu page -->
32
- <%= render :partial => 'mcms_pages/pages/menu' if not @page.link_url == '\404' %>
33
-
34
- <!-- render partial on the basis of layout name which is based on column count -->
35
- <%= render :partial => "mcms_pages/pages/"+layout_name(@page.layout.column_count), :locals => {:page => page, :p => @page} %>
36
-
37
- <div style="clear:both;"></div>
38
-
39
- <!-- render partial for footer -->
40
- <%= render :partial => 'mcms_pages/layouts/footer', :locals => {:p => page["footer"]} %>
41
-
42
- <% end %>
35
+ <!-- render partial for footer -->
36
+ <%= render :partial => 'mcms_pages/layouts/footer', :locals => {:p => page["footer"]} unless page["footer"].nil? %>
43
37
 
data/config/routes.rb CHANGED
@@ -22,6 +22,8 @@ Rails.application.routes.draw do
22
22
  # post to page preview action
23
23
  post 'pages/preview' => 'pages#preview', :as => :preview_pages
24
24
 
25
+ match 'pages/blog/preview' => redirect("/blog/posts") if Gem.available?("mcms_blog")
26
+
25
27
  # match pages/**/preview to action preview of pages controller
26
28
  match 'pages/*path/preview' => 'pages#preview', :as => :preview_page, :via => [:get, :put]
27
29
 
@@ -37,7 +39,15 @@ Rails.application.routes.draw do
37
39
  # and redirect to edit action
38
40
  get 'pages/*path/edit', :to => 'pages#edit'
39
41
 
40
- resources :layouts
42
+ resources :layouts do
43
+
44
+ collection do
45
+
46
+ get 'find_and_use_layout'
47
+
48
+ end
49
+
50
+ end
41
51
 
42
52
  resources :pages do
43
53
 
@@ -2,8 +2,8 @@ class CreateLayouts < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :mcms_layouts do |t|
4
4
  t.string :name
5
- t.boolean :left
6
- t.boolean :right
5
+ t.boolean :lft
6
+ t.boolean :rgt
7
7
  t.boolean :main
8
8
  t.integer :column_count
9
9
 
@@ -11,6 +11,7 @@ class CreateLayouts < ActiveRecord::Migration
11
11
  end
12
12
 
13
13
  add_index :mcms_layouts, :name, :unique => true
14
-
14
+
15
15
  end
16
16
  end
17
+
data/db/seeds.rb CHANGED
@@ -13,62 +13,24 @@
13
13
 
14
14
  if Layout.all.empty?
15
15
 
16
- Layout.create({
17
-
18
- :name => "one column",
19
- :left => 0,
20
- :right => 0,
21
- :main => 1,
22
- :header => 1,
23
- :footer => 1,
24
- :column_count => 1
25
-
26
- })
27
- Layout.create({
28
-
29
- :name => "two column with right",
30
- :left => 0,
31
- :right => 1,
32
- :main => 1,
33
- :header => 1,
34
- :footer => 1,
35
- :column_count => 2
36
-
37
- })
38
- Layout.create({
39
-
40
- :name => "two column with left",
41
- :left => 1,
42
- :right => 0,
43
- :main => 1,
44
- :header => 1,
45
- :footer => 1,
46
- :column_count => 2
47
-
48
- })
49
- Layout.create({
50
-
51
- :name => "three column",
52
- :left => 1,
53
- :right => 1,
54
- :main => 1,
55
- :header => 1,
56
- :footer => 1,
57
- :column_count => 3
58
-
59
- })
60
-
61
- Layout.create({
62
-
63
- :name => "default",
64
- :left => 0,
65
- :right => 0,
66
- :main => 1,
67
- :header => 0,
68
- :footer => 0,
69
- :column_count => 0
70
-
71
- })
16
+ Layout.create([
17
+ { :name => "one column", :lft => 0, :rgt => 0, :main => 1, :header => 1, :footer => 1, :column_count => 1 },
18
+ { :name => "two column with right", :lft => 0, :rgt => 1, :main => 1, :header => 1, :footer => 1, :column_count => 2 },
19
+ { :name => "two column with left", :lft => 1, :rgt => 0, :main => 1, :header => 1, :footer => 1, :column_count => 2 },
20
+ { :name => "three column", :lft => 1, :rgt => 1, :main => 1, :header => 1, :footer => 1, :column_count => 3 },
21
+ { :name => "default", :lft => 0, :rgt => 0, :main => 1, :header => 0, :footer => 0, :column_count => 0 },
22
+ { :name => "one column without header", :lft => 0, :rgt => 0, :main => 1, :header => 0, :footer => 1, :column_count => 1 },
23
+ { :name => "two column without header", :lft => 0, :rgt => 1, :main => 1, :header => 0, :footer => 1, :column_count => 2},
24
+ { :name => "two column with left without header", :lft =>1, :rgt => 0, :main => 1, :header => 0, :footer => 1, :column_count => 2},
25
+ { :name => "three column without header", :lft => 1, :rgt => 1, :main => 1, :header => 0, :footer => 1, :column_count => 3},
26
+ { :name => "one column without footer", :lft => 0, :rgt => 0, :main => 1, :header => 1, :footer => 0, :column_count => 1},
27
+ { :name => "two column without footer", :lft => 0, :rgt => 1, :main => 1, :header => 1, :footer => 0, :column_count => 2},
28
+ { :name => "two column with left without footer", :lft => 1, :rgt => 0, :main => 1, :header => 1, :footer => 0, :column_count => 2},
29
+ { :name => "three column without footer", :lft => 1, :rgt => 1, :main => 1, :header => 1, :footer => 0, :column_count => 2},
30
+ { :name => "two column without left", :lft => 1, :rgt => 0, :main => 1, :header => 0, :footer => 0, :column_count => 2},
31
+ { :name => "two column without right", :lft => 0, :rgt => 1, :main => 1, :header => 0, :footer => 0, :column_count => 2},
32
+ { :name => "three column without header footer", :lft => 1, :rgt => 1, :main => 1, :header => 0, :footer => 0, :column_count => 3}
33
+ ])
72
34
 
73
35
 
74
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcms_pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-13 00:00:00.000000000 Z
12
+ date: 2012-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -130,6 +130,7 @@ executables: []
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
+ - app/views/mcms_pages/admin/layouts/_index.js.erb
133
134
  - app/views/mcms_pages/admin/layouts/index.html.erb
134
135
  - app/views/mcms_pages/admin/pages/new.html.erb
135
136
  - app/views/mcms_pages/admin/pages/_page_part_form.html.erb
@@ -154,15 +155,9 @@ files:
154
155
  - app/views/mcms_pages/layouts/_head.html.erb
155
156
  - app/views/mcms_pages/layouts/_footer.html.erb
156
157
  - app/views/mcms_pages/pages/_main_body.html.erb
157
- - app/views/mcms_pages/pages/_right_side_body.html.erb
158
- - app/views/mcms_pages/pages/home.html.erb
159
- - app/views/mcms_pages/pages/_left_side_body.html.erb
160
- - app/views/mcms_pages/pages/_three_column_layout.html.erb
161
158
  - app/views/mcms_pages/pages/_menu.html.erb
162
159
  - app/views/mcms_pages/pages/_menubar.html.erb
163
- - app/views/mcms_pages/pages/_one_column_layout.html.erb
164
160
  - app/views/mcms_pages/pages/show.html.erb
165
- - app/views/mcms_pages/pages/_two_column_layout.html.erb
166
161
  - app/assets/images/mcms_pages/tab_on.jpg
167
162
  - app/assets/images/mcms_pages/background.jpg
168
163
  - app/assets/images/mcms_pages/branch.gif
@@ -1,13 +0,0 @@
1
- <!--
2
- @File Name : _left_side_body.html.erb
3
- @Company Name : Mindfire Solutions Private Limited
4
- @Creator Name : Vikram Kumar Mishra
5
- @Date Created : 2012-06-14
6
- @Date Modified :
7
- @Last Modification Details :
8
- @Purpose : To display the left side content of pages.
9
-
10
- -->
11
-
12
- <%= p.body.html_safe unless p.nil? %>
13
-
@@ -1,17 +0,0 @@
1
- <!--
2
- @File Name : one_column_layout.html.erb
3
- @Company Name : Mindfire Solutions Private Limited
4
- @Creator Name : Vikram Kumar Mishra
5
- @Date Created : 2012-06-14
6
- @Date Modified : 2012-06-15
7
- @Last Modification Details : partial rendered and previous code deleted
8
- @Purpose : The partial to display one column architecture
9
-
10
- -->
11
-
12
- <div id="one-column-main-body" class="page-main-body">
13
-
14
- <%= render :partial => "mcms_pages/pages/main_body", :locals => {:p => page["main body"]} %>
15
-
16
- </div>
17
-
@@ -1,13 +0,0 @@
1
- <!--
2
- @File Name : _right_side_body.html.erb
3
- @Company Name : Mindfire Solutions Private Limited
4
- @Creator Name : Vikram Kumar Mishra
5
- @Date Created : 2012-06-14
6
- @Date Modified :
7
- @Last Modification Details :
8
- @Purpose : To display the right side content of pages.
9
-
10
- -->
11
-
12
- <%= p.body.html_safe unless p.nil? %>
13
-
@@ -1,31 +0,0 @@
1
- <!--
2
- @File Name : three_column_layout.html.erb
3
- @Company Name : Mindfire Solutions Private Limited
4
- @Creator Name : Vikram Kumar Mishra
5
- @Date Created : 2012-06-14
6
- @Date Modified :
7
- @Last Modification Details :
8
- @Purpose : To display three column architecture layout.
9
-
10
- -->
11
-
12
- <div id="three-column-left-body" class="page-left-body">
13
-
14
- <!-- render partial _left_side_body.html.erb -->
15
- <%= render "mcms_pages/pages/left_side_body", :p => page["left body"] %>
16
-
17
- </div>
18
-
19
- <div id="three-column-main-body" class="page-main-body">
20
-
21
- <%= render :partial => "mcms_pages/pages/main_body", :locals => {:p => page["main body"]} %>
22
-
23
- </div>
24
-
25
- <div id="three-column-right-body" class="page-right-body">
26
-
27
- <!-- render partial _right_side_body.html.erb -->
28
- <%= render "mcms_pages/pages/right_side_body", :p => page["right body"] %>
29
-
30
- </div>
31
-
@@ -1,39 +0,0 @@
1
- <!--
2
- @File Name : two_column_layout.html.erb
3
- @Company Name : Mindfire Solutions Private Limited
4
- @Creator Name : Vikram Kumar Mishra
5
- @Date Created : 2012-06-14
6
- @Date Modified :
7
- @Last Modification Details :
8
- @Purpose : To display two column(main and left or right) architecture layout
9
-
10
- -->
11
-
12
- <% unless page["left body"].nil? %>
13
-
14
- <div id="two-column-left-body" class="page-left-body">
15
-
16
- <!-- render partial _left_side_body.html.erb -->
17
- <%= render "mcms_pages/pages/left_side_body", :p => page["left body"] %>
18
-
19
- </div>
20
-
21
- <% end %>
22
-
23
- <div id="two-column-main-body" class="page-main-body">
24
-
25
- <%= render :partial => "mcms_pages/pages/main_body", :locals => {:p => page["main body"]} %>
26
-
27
- </div>
28
-
29
- <% unless page["right body"].nil? %>
30
-
31
- <div id="two-column-right-body" class="page-right-body">
32
-
33
- <!-- render partial _left_side_body.html.erb -->
34
- <%= render "mcms_pages/pages/right_side_body", :p => page["right body"] %>
35
-
36
- </div>
37
-
38
- <% end %>
39
-
@@ -1,28 +0,0 @@
1
- <!--
2
- @File Name : pages/home.html.erb
3
- @Company Name : Mindfire Solutions Private Limited
4
- @Creator Name : Vikram Kumar Mishra
5
- @Date Created : 2012-06-19
6
- @Date Modified :
7
- @Last Modification Details :
8
- @Purpose : To show the home page to the user.
9
-
10
- -->
11
- <!-- calling helper method to arrange page part of a page -->
12
- <% page = arrange_page_part(@page) %>
13
-
14
- <!-- render notice/alert -->
15
- <p><%= flash[:notice] || flash[:error] %></p>
16
-
17
- <!-- render partial for header -->
18
- <%= render :partial => 'mcms_pages/layouts/header', :locals => {:p => page["header"]} %>
19
-
20
- <!-- render menu page -->
21
- <%= render :partial => 'mcms_pages/pages/menu' if not @page.link_url == '\404' %>
22
-
23
- <!-- render partial on the basis of layout name which is based on column count -->
24
- <%= render :partial => "mcms_pages/pages/"+layout_name(@page.layout.column_count), :locals => {:page => page, :p => @page} %>
25
-
26
- <!-- render partial for footer -->
27
- <%= render :partial => 'mcms_pages/layouts/footer', :locals => {:p => page["footer"]} %>
28
-