myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2790] trunk: Merged elico branch 2719:2789 into


From: noreply
Subject: [myexperiment-hackers] [2790] trunk: Merged elico branch 2719:2789 into trunk
Date: Wed, 9 Nov 2011 05:26:45 -0500 (EST)

Revision
2790
Author
fbacall
Date
2011-11-09 05:26:44 -0500 (Wed, 09 Nov 2011)

Log Message

Merged elico branch 2719:2789 into trunk

Modified Paths

Added Paths

Diff

Modified: trunk/app/controllers/application.rb (2789 => 2790)


--- trunk/app/controllers/application.rb	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/controllers/application.rb	2011-11-09 10:26:44 UTC (rev 2790)
@@ -12,7 +12,7 @@
   
   WhiteListHelper.tags.merge %w(table tr td th div span)
   
-  before_filter :set_configuration
+  #before_filter :set_configuration
 
   include AuthenticatedSystem
   before_filter :login_from_cookie
@@ -1173,5 +1173,22 @@
       :query_problem           => query_problem
     }
   end
+
+  #Applies the layout for the Network with the given network_id to the object (contributable)
+  def update_layout(object,network_id)
+    if network_id.blank?
+      object.contribution.layout = nil
+      object.contribution.save
+    else
+      network = Network.find(network_id.to_i)
+      # Have to call .reload on permissions or the cached permissions from before "update_policy" was called are used
+      if network && find_permission_for_contributor(object.contribution.policy.permissions.reload, "Network", network_id.to_i)
+        object.contribution.layout = network.layout_name
+        object.contribution.save
+      else
+        object.errors.add_to_base("You may only choose layouts for groups that this #{object.class.name.downcase} is shared with.")
+      end
+    end
+
+  end
 end
-

Modified: trunk/app/controllers/blobs_controller.rb (2789 => 2790)


--- trunk/app/controllers/blobs_controller.rb	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/controllers/blobs_controller.rb	2011-11-09 10:26:44 UTC (rev 2790)
@@ -150,6 +150,7 @@
           @blob.contribution.update_attributes(params[:contribution])
         
           policy_err_msg = update_policy(@blob, params)
+          update_layout(@blob, params[:layout])
         
           update_credits(@blob, params)
           update_attributions(@blob, params)
@@ -195,6 +196,7 @@
         policy_err_msg = update_policy(@blob, params)
         update_credits(@blob, params)
         update_attributions(@blob, params)
+        update_layout(@blob, params[:layout])
         
         if policy_err_msg.blank?
           flash[:notice] = 'File was successfully updated.'

Modified: trunk/app/controllers/packs_controller.rb (2789 => 2790)


--- trunk/app/controllers/packs_controller.rb	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/controllers/packs_controller.rb	2011-11-09 10:26:44 UTC (rev 2790)
@@ -127,6 +127,7 @@
         
         # update policy
         policy_err_msg = update_policy(@pack, params)
+        update_layout(@pack, params[:layout])
         
         if policy_err_msg.blank?
           flash[:notice] = 'Pack was successfully created.'
@@ -155,6 +156,7 @@
       if @pack.update_attributes(params[:pack])
         @pack.refresh_tags(convert_tags_to_gem_format(params[:pack][:tag_list]), current_user) if params[:pack][:tag_list]
         policy_err_msg = update_policy(@pack, params)
+        update_layout(@pack, params[:layout])
         
         if policy_err_msg.blank?
           flash[:notice] = 'Pack was successfully updated.'

Modified: trunk/app/controllers/workflows_controller.rb (2789 => 2790)


--- trunk/app/controllers/workflows_controller.rb	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/controllers/workflows_controller.rb	2011-11-09 10:26:44 UTC (rev 2790)
@@ -343,10 +343,12 @@
         end
 
         policy_err_msg = update_policy(@workflow, params)
-    
+
         # Credits and Attributions:
         update_credits(@workflow, params)
         update_attributions(@workflow, params)
+
+        update_layout(@workflow, params[:layout])
         
         # Refresh the types handler list of types if a new type was supplied this time.
         WorkflowTypesHandler.refresh_all_known_types! if params[:workflow][:type] == 'other'
@@ -501,7 +503,7 @@
         end
       end
     end
-    
+
     params[:workflow][:license_id] = nil if params[:workflow][:license_id] && params[:workflow][:license_id] == "0"
 
     respond_to do |format|
@@ -521,6 +523,8 @@
         update_credits(@workflow, params)
         update_attributions(@workflow, params)
 
+        update_layout(@workflow, params[:layout])
+
         if policy_err_msg.blank?
           flash[:notice] = 'Workflow was successfully updated.'
           format.html { redirect_to workflow_url(@workflow) }
@@ -690,6 +694,7 @@
       
       if Authorization.is_authorized?(action_name, nil, workflow, current_user)
         @latest_version_number = workflow.current_version
+
         @workflow = workflow
         if params[:version]
           if (viewing = @workflow.find_version(params[:version]))
@@ -854,6 +859,28 @@
   
 private
 
+
+  #Upon specifying a group to share with, prompts the user whether or not they want to apply the groups'
+  # custom skin
+
+  def check_sharing_with_branded_group(new_groups)
+    @groups_with_custom_layouts = nil
+    new_shared_with_groups = nil
+
+    # check if "shared with" groups has been changed in the update
+    if action == "create" && params[:group_sharing]
+      new_shared_with_groups = params[:group_sharing].keys
+    elsif action == "update" && (@shared_with_groups_pre_update != @workflow.shared_with_networks)
+      new_shared_with_groups = (@workflow.shared_with_networks - @shared_with_groups_pre_update).map { |n| n.ids }
+    end
+
+    if new_shared_with_groups && !params[:workflow][:skin]
+      # check whether an added/removed group had styling options available
+      group_ids = Conf.virtual_hosts.values.map {|v| v['group_id']} & new_shared_with_groups
+      @groups_with_custom_layouts = Network.find(group_ids)
+    end
+  end
+
   def error(notice, message, attr=:id)
     flash[:error] = notice
     (err = Workflow.new.errors).add(attr, message)

Modified: trunk/app/helpers/application_helper.rb (2789 => 2790)


--- trunk/app/helpers/application_helper.rb	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/helpers/application_helper.rb	2011-11-09 10:26:44 UTC (rev 2790)
@@ -799,7 +799,7 @@
   def expand_image(margin_left="0.3em")
     image_tag "folds/unfold.png", :style => "margin-left: #{margin_left}; vertical-align: middle;", :alt => 'Expand'
   end
-  
+  
   def user_tags_for_thing(taggable, user_id)
     return [] if taggable.nil? or user_id.nil? 
     
@@ -827,7 +827,7 @@
 
     return tags
   end
-
+
   def highlight_all(text, string)
     rtn = text
     
@@ -1605,4 +1605,21 @@
 
     result
   end
+
+  #Selects layout for contributables/groups or uses site's default
+  def configure_layout
+    contributable = (@workflow || @pack || @blog_post || @blob)
+    layout = nil
+
+    if params["layout_preview"]
+      layout = Conf.layouts[params["layout_preview"]]
+    elsif contributable && contributable.contribution
+      layout = Conf.layouts[contributable.contribution.layout]
+    elsif @network
+      layout = @network.layout
+    end
+
+    @layout = layout || {"layout" => Conf.page_template, "stylesheets" => [Conf.stylesheet]}
+  end
+
 end

Modified: trunk/app/models/network.rb (2789 => 2790)


--- trunk/app/models/network.rb	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/models/network.rb	2011-11-09 10:26:44 UTC (rev 2790)
@@ -212,4 +212,19 @@
   def invitation_only?
     new_member_policy == :invitation_only
   end
+
+  #Returns the page_template defined for this network in settings.yml > layouts:
+  def layout_name
+    Conf.layouts.each do |k,v|
+      if v["network_id"] == id
+        return k
+      end
+    end
+
+    return nil
+  end
+
+  def layout
+    Conf.layouts[layout_name]
+  end
 end

Modified: trunk/app/models/workflow.rb (2789 => 2790)


--- trunk/app/models/workflow.rb	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/models/workflow.rb	2011-11-09 10:26:44 UTC (rev 2790)
@@ -55,12 +55,12 @@
 
   has_previews
 
-  explicit_versioning(:version_column => "current_version", 
+  explicit_versioning(:version_column => "current_version",
                       :extra_attributes => ["image", "svg"],
                       :white_list_columns => ["body"]) do
     
     format_attribute :body
-    
+
     belongs_to :content_blob
     belongs_to :content_type
 

Modified: trunk/app/views/blog_posts/show.rhtml (2789 => 2790)


--- trunk/app/views/blog_posts/show.rhtml	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/views/blog_posts/show.rhtml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -1,3 +1,9 @@
+<% if logged_in? && Authorization.is_authorized?("edit", nil, @blog_post.blog, current_user) %>
+  <ul class="sectionIcons">
+    <li><%= link_to 'Edit Blog Post', edit_blog_post_path(@blog_post.blog, @blog_post) %></li>
+  </ul>
+<% end %>
+
 <p>
   <b>Blog:</b>
   <%=h @blog_post.blog_id %>

Modified: trunk/app/views/contributions/_sharing_form.rhtml (2789 => 2790)


--- trunk/app/views/contributions/_sharing_form.rhtml	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/views/contributions/_sharing_form.rhtml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -144,25 +144,76 @@
 		<!-- Explicit Group Permissions -->
 		<p><strong>Share with my Groups:</strong></p>
 
-		<div id="group_sharing_box" class="box_editing" style="padding-left: 1em; font-size: 93%;">
-      <% for n in (current_user.networks + current_user.networks_owned) %>
-          <p>
-          	<% perm = find_permission_for_contributor(perms, "Network", n.id) if edit -%>
-						<label for="" n.id %>">
-							<input <%= 'checked' if perm %> style="margin-right: 0.3em;"
-          		value="<%= n.id %>" type="checkbox" name="group_sharing[<%= n.id %>][id]" id="cb_group_sharing_<%= n.id %>" />
-						  <%= h(n.title) %>
-						</label>
-						<select name="group_sharing[<%= n.id %>][level]" style="font-size: 85%; margin: 0 0.5em;">
-							<option value="0" <%= 'selected="selected"' if perm and perm.level == 0 %>>View only</option>
-							<option value="1" <%= 'selected="selected"' if !edit or !perm or (perm and perm.level == 1) %>>View and Download only</option>
-							<option value="2" <%= 'selected="selected"' if perm and perm.level == 2 %>>View, Download and Update</option>
-						</select>
-					</p>
-        <% end %>
-		</div>
+    <div id="group_sharing_box" class="box_editing" style="padding-left: 1em; font-size: 93%;">
+      <% applicable_networks = (current_user.networks + current_user.networks_owned) %>
+      <% applicable_networks.each do |n| %>
+        <p>
+          <% perm = find_permission_for_contributor(perms, "Network", n.id) if edit -%>
+          <label for="" n.id %>">
+            <input class="group_sharing" <%= 'checked' if perm %> style="margin-right: 0.3em;"
+                   value="<%= n.id %>" type="checkbox" name="group_sharing[<%= n.id %>][id]" id="cb_group_sharing_<%= n.id %>"
+                    this.checked);"/>
+            <%= h(n.title) %>
+          </label>
+          <select name="group_sharing[<%= n.id %>][level]" style="font-size: 85%; margin: 0 0.5em;">
+            <option value="0" <%= 'selected="selected"' if perm and perm.level == 0 %>>View only</option>
+            <option value="1" <%= 'selected="selected"' if !edit or !perm or (perm and perm.level == 1) %>>View and Download only</option>
+            <option value="2" <%= 'selected="selected"' if perm and perm.level == 2 %>>View, Download and Update</option>
+          </select>
+        </p>
+      <% end %>
+      <br/>
+      <% if %w(Workflow Pack File).include?(c_type) %>
+        <div id="layout_options_box">
+          <strong>Layout:</strong>
+          <div class="box_infotext" style="margin: 1em 0">
+            <p>
+              One or more of the groups you have elected to share this <%= c_type -%> with have custom layouts specified.
+              To apply a group's custom layout to this <%= c_type -%>'s page, choose one from the list below or select
+              "Default" to keep the <%= Conf.sitename -%> default layout. This setting can be changed at any time by
+              visiting the 'edit' page.
+            </p>
+          </div>
+          <% selected_option = (Conf.layouts[contributable.contribution.layout]["network_id"] unless
+              contributable.contribution.nil? || contributable.contribution.layout.nil?) %>
+          <%= select_tag "layout", "<option value="">Default</option>" +
+              options_from_collection_for_select(applicable_networks.select {|n| n.layout_name}, 'id','title', selected_option) %>
+          <%# TODO: In Rails 2, have a link that allows a user to preview the selected layout using polymorphic_path %>
+        </div>
+      <% end %>
+    </div>
   </div>
 </div>
 
 <script>update_sharing(<%= @sharing_mode %>)</script>
+<script type="text/_javascript_">
+
+  function toggle_layout_option(id, enable) {
+    var option = $$('select#layout option[value=' + id + ']').first();
+
+    //If a "share with group" box is unticked, and that group's layout is selected, go to default.
+    if(!enable){
+      if($('layout').selectedIndex == option.index){
+        $('layout').selectedIndex = 0;
+      }
+    }
+
+    //Disable/enable option in dropdown menu
+    option.disabled = !enable;
+
+    //If all options except "default" are disabled, hide the layout option box
+    if($$('select#layout option[disabled]').size() == ($$('select#layout option').size() - 1)) {
+      $('layout_options_box').hide();
+    }
+    else {
+      $('layout_options_box').show();
+    }
+  }
+
+  //Initial state
+  $$('input.group_sharing').each (function (box) {
+    toggle_layout_option(box.value, box.checked);
+  });
+</script>
+
 <% if update_perms -%><script>update_updating(<%= @updating_mode %>)</script><% end -%>

Copied: trunk/app/views/layouts/_alerts.rhtml (from rev 2789, branches/elico/app/views/layouts/_alerts.rhtml) (0 => 2790)


--- trunk/app/views/layouts/_alerts.rhtml	                        (rev 0)
+++ trunk/app/views/layouts/_alerts.rhtml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -0,0 +1,14 @@
+<% if flash[:error] %>
+  <div id="error_flash" class="box_standout">
+    <%= link_to_function image_tag("close.gif", :style => "float: right;"),
+                         visual_effect(:toggle_slide, "error_flash", :duration => 0.3) %>
+    <%= white_list flash[:error] %>
+  </div>
+<% end %>
+<% if flash[:notice] %>
+  <div id="notice_flash" class="box_standout">
+    <%= link_to_function image_tag("close.gif", :style => "float: right;"),
+                         visual_effect(:toggle_slide, "notice_flash", :duration => 0.3) %>
+    <%= white_list flash[:notice] %>
+  </div>
+<% end %>
\ No newline at end of file

Copied: trunk/app/views/layouts/_elico.rhtml (from rev 2789, branches/elico/app/views/layouts/_elico.rhtml) (0 => 2790)


--- trunk/app/views/layouts/_elico.rhtml	                        (rev 0)
+++ trunk/app/views/layouts/_elico.rhtml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -0,0 +1,49 @@
+<%# Defines a new header, then calls main myExperiment layout %>
+
+<% content_for :header do %>
+</div>
+
+<div id="elico_header">
+  <div class="logo">
+    <div style="float: left; margin-bottom: 0.5em">
+      <img src="" style="float: left; vertical-align: middle; width: 60px; height: 60px"/>
+      <div style="float: left; margin-top: 1em; margin-left: 1em">
+        <div style="font-size: 220%; font-weight: bold; vertical-align: middle">Data Mining Portal</div>
+        <div style="margin: 0.5em 0 0 1em">
+          on <%= link_to image_tag("/images/logo_tiny.png", :style=>"-moz-border-radius: 2px; border-radius: 2px; vertical-align: middle;border: 1px solid white"), "/" -%>
+        </div>
+      </div>
+    </div>
+    <div style="float: right; font-size: 120%; margin-top: 1.5em">
+      e-Laboratory for Interdisciplinary Collaborative Data Mining
+    </div>
+    <br class="clearer"/>
+  </div>
+  <div id="elico_links_bar">
+    <div id="inner">
+      <div style="float: left;" class="links">
+        <%= link_to "About", "http://www.e-lico.eu/?q=node/4", :target => '_blank' %> |
+        <%= link_to "Mailing List", "http://lists.e-lico.eu/mailman/listinfo/dm-myexperiment", :target => '_blank' %> |
+        <%= link_to "Publications", "http://www.e-lico.eu/?q=publications", :target => '_blank' %>
+      </div>
+      <div style="float: right;" class="links">
+        <%= render :partial => 'layouts/user_links' %>
+      </div>
+      <br class="clearer"/>
+    </div>
+  </div>
+</div>
+
+<div id="doc2" class="yui-t4" style="*overflow: visible; *height: auto">
+  <div id="hd">
+    <div id="myexp_tabs">
+      <%= render :partial => 'layouts/tab_bar' %>
+    </div>
+    <div id="myexp_searchbar">
+      <%= render :partial => "layouts/search" %>
+    </div>
+  </div>
+<% end %>
+
+<%# TODO: In rails 2, this can possibly be removed, and the layout specified when rendering the partial in application.rhtml %>
+<%= render :partial => "layouts/myexperiment" %>

Modified: trunk/app/views/layouts/_footer.rhtml (2789 => 2790)


--- trunk/app/views/layouts/_footer.rhtml	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/views/layouts/_footer.rhtml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -47,4 +47,3 @@
 		</tr>
 	</table>
 </div>
-

Modified: trunk/app/views/layouts/_myexperiment.rhtml (2789 => 2790)


--- trunk/app/views/layouts/_myexperiment.rhtml	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/views/layouts/_myexperiment.rhtml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -1,121 +1,106 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-  <head>
-    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
-    <%= t :site => "#{Conf.sitename} &#45; #{controller_visible_name(controller.controller_name.humanize)}", :separator => "&#45;" %>
-<% if @lod_rdf %>    <link rel="alternate" href="" @lod_rdf -%>" type="application/rdf+xml" title="RDF+XML" /><% end %>
-<% if @lod_xml %>    <link rel="alternate" href="" @lod_xml -%>" type="application/xml" title="REST XML" /><% end %>
-    <link rel="shortcut icon" href="" type="image/x-icon"/>
-    <%= stylesheet_link_tag 'reset-fonts-grids' %>
-    <%= stylesheet_link_tag 'base-min' %>
-    <%= stylesheet_link_tag 'acts_as_taggable_stylesheet' %>
-    <%= stylesheet_link_tag 'star_rating' %>
-    <%= stylesheet_link_tag Conf.stylesheet %>
-    <%= stylesheet_link_tag 'gadgets' %>
-    
-    <% if controller.action_name.downcase == "timeline" %>
-      <script src="" type="text/_javascript_"></script>
-    <% end -%>
-    
-    <%= _javascript__include_tag :defaults %>
-    <%= _javascript__include_tag "boxover.js" %>
-    
-    <%= render :partial => "layouts/feed_link_tags" %>
+<head>
+  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
+  <%= t :site => "#{Conf.sitename} &#45; #{controller_visible_name(controller.controller_name.humanize)}", :separator => "&#45;" %>
+  <% if @lod_rdf %><link rel="alternate" href="" @lod_rdf -%>" type="application/rdf+xml" title="RDF+XML" /><% end %>
+  <% if @lod_xml %><link rel="alternate" href="" @lod_xml -%>" type="application/xml" title="REST XML" /><% end %>
+  <link rel="shortcut icon" href="" type="image/x-icon"/>
+  <%= stylesheet_link_tag 'reset-fonts-grids', 'base-min', 'acts_as_taggable_stylesheet', 'star_rating', 'gadgets', address@hidden"stylesheets"] %>
+  <%= _javascript__include_tag :defaults, "boxover.js" %>
 
-    <% if @extra_head_content %>
-      <%= @extra_head_content -%>
-    <% end %>
+  <% if controller.action_name.downcase == "timeline" %>
+    <script src="" type="text/_javascript_"></script>
+  <% end -%>
 
-  </head>
-  <body>
-    <div id="doc2" class="yui-t4">
-      <div id="hd">
-          <div id="myexp_header">
-            <div class="logo">
+  <%= render :partial => "layouts/feed_link_tags" %>
+
+  <%= yield :head_options -%>
+</head>
+<body>
+
+<div id="doc2" class="yui-t4">
+
+  <%# TODO: Rails 2: '@content_for_x' has changed to 'content_for?(:x)' in later versions of rails %>
+  <% if @content_for_header %>
+    <%= yield :header %>
+  <% else %>
+    <div id="hd">
+      <div id="myexp_header">
+        <div class="logo">
+          <% if @content_for_logo %>
+            <%= yield :logo %>
+          <% else %>
             <%= link_to image_tag(Conf.site_logo), "/" %>
+          <% end %>
+          <div id="site_info_links" class="links">
+            <% if @content_for_site_info_links %>
+              <%= yield :site_info_links %>
+            <% else %>
+              <%= render :partial => 'layouts/site_info_links' %>
+            <% end %>
           </div>
-          <div class="links">
-            <div style="text-align: left; float: left; width: 34%; padding-top: 6px;">
-              <span><b><%= link_to "About", "http://wiki.myexperiment.org/", :target => '_blank' %></b></span>
-              <span>&nbsp;|&nbsp;</span>
-              <span><b><%= link_to "Mailing List", "http://lists.nongnu.org/mailman/listinfo/myexperiment-discuss", :target => '_blank' %></b></span>
-              <span>&nbsp;|&nbsp;</span>
-              <span><b><%= link_to "Publications", "http://wiki.myexperiment.org/index.php/Papers", :target => '_blank' %></b></span>
-            </div>
-            <div style="text-align: right; float: right; width: 64%;">
-              <% if logged_in? -%>
-                <span><b><%= signout_link -%></b></span>
-              <% else -%>
-                <span><b><%= icon "login", new_session_url, nil, nil, "Log in" -%></b></span>
-                <span>&nbsp;|&nbsp;</span>
-                <span><b><%= icon "user", new_user_url, nil, nil, "Register" -%></b></span>
-              <% end %>
-              <span>&nbsp;|&nbsp;</span>
-              <span><b><%= icon "feedback", "/feedback", nil, nil, "Give us Feedback" -%></b></span>
-              <span>&nbsp;|&nbsp;</span>
-              <span><b><%= icon "user-invite", invite_users_path, nil, nil, "Invite" -%></b></span>
-            </div>
-            <div class="clearer">&nbsp;</div>
-          </div>
-          <div class="clearer">&nbsp;</div>
         </div>
-        <div>
-          <ul class="tabnav">
-                                          <% Conf.main_tabs.each do |tab| %>
-                                            <li <%= (tab['controller'] && controller.controller_name.match(tab['controller'])) ? 'id="selected_tabnav"' : '' %>>
-                                              <%= link_to(tab['label'], tab['link']) -%>
-                                            </li>
-                                          <% end %>
-          </ul>
+        <div id="user_links" class="links">
+          <%= render :partial => 'layouts/user_links' %>
         </div>
-          <div id="myexp_searchbar"><%= render :partial => "layouts/search" %></div>
+        <br class="clearer"/>
       </div>
-      <div id="bd">
-        <div id="yui-main"> 
-            <div class="yui-b">
-              <div id="myexp_breadcrumbs_bar">
-                <%= render :partial => "layouts/breadcrumbs_bar" %>
-              </div>
-              <div id="myexp_content">
-                <% if flash[:error] %>
-                  <div id="error_flash" class="box_standout" style="color: red; font-weight: bold; margin-bottom: 1.5em; line-height: 1.4;">
-                    <%= link_to_function image_tag("close.gif", :style => "float: right;"), 
-                                         visual_effect(:toggle_slide, "error_flash", :duration => 0.3) %>
-                    <%= white_list flash[:error] %>
-                  </div>
-                <% end %>
-                <% if flash[:notice] %>
-                  <div id="notice_flash" class="box_standout" style="color: green; font-weight: bold; margin-bottom: 1.5em; line-height: 1.4;">
-                    <%= link_to_function image_tag("close.gif", :style => "float: right;"), 
-                                         visual_effect(:toggle_slide, "notice_flash", :duration => 0.3) %>
-                    <%= white_list flash[:notice] %>
-                  </div>
-                <% end %>
-                
-                <%= render :partial => "subnav" %>
-                
-                <%= yield :layout %>
-            </div>
+      <div id="myexp_tabs">
+        <%= render :partial => 'layouts/tab_bar' %>
+      </div>
+      <div id="myexp_searchbar">
+        <%= render :partial => "layouts/search" %>
+      </div>
+    </div>
+  <% end %>
+
+
+  <% if @content_for_body %>
+    <%= yield :body %>
+  <% else %>
+    <div id="bd">
+      <div id="yui-main">
+        <div class="yui-b">
+          <div id="myexp_breadcrumbs_bar">
+            <%= render :partial => "layouts/breadcrumbs_bar" %>
           </div>
+          <div id="myexp_content">
+            <%= render :partial => 'layouts/alerts' %>
+
+            <%= yield :layout %>
+
+          </div>
         </div>
-        <div id="myexp_sidebar" class="yui-b">
-          <%= render :partial => "layouts/sidebar" %>
-        </div>
       </div>
+      <div id="myexp_sidebar" class="yui-b">
+        <%= render :partial => "layouts/sidebar" %>
+      </div>
+    </div>
+  <% end %>
+
+
+  <% if @content_for_footer %>
+    <%= yield :footer %>
+  <% else %>
       <% cache(:controller => 'global_cache', :action ="" 'footer') do -%>
         <div id="ft">
           <%= render :partial => "layouts/footer" %>
         </div>
-      <% end -%>
-      
-      <%= render :partial => "layouts/debug" if Conf.show_debug %> 
-    </div>
-    
-    <%= _javascript__include_tag "tabs.js" %>
-    <%= _javascript__include_tag "folds.js" %>
-    
-    <%= render :partial => "layouts/web_analytics" if Conf.google_web_analytics["enable"] %>
-  </body>
+      <br class="clearer"/>
+    <% end -%>
+  <% end %>
+
+
+  <%= render :partial => "layouts/debug" if Conf.show_debug %>
+</div>
+
+<%= _javascript__include_tag "tabs.js" %>
+<%= _javascript__include_tag "folds.js" %>
+
+<%= render :partial => "layouts/web_analytics" if Conf.google_web_analytics["enable"] %>
+
+</body>
 </html>

Copied: trunk/app/views/layouts/_site_info_links.rhtml (from rev 2789, branches/elico/app/views/layouts/_site_info_links.rhtml) (0 => 2790)


--- trunk/app/views/layouts/_site_info_links.rhtml	                        (rev 0)
+++ trunk/app/views/layouts/_site_info_links.rhtml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -0,0 +1,3 @@
+<%= link_to "About", "http://wiki.myexperiment.org/", :target => '_blank' %> |
+<%= link_to "Mailing List", "http://lists.nongnu.org/mailman/listinfo/myexperiment-discuss", :target => '_blank' %> |
+<%= link_to "Publications", "http://wiki.myexperiment.org/index.php/Papers", :target => '_blank' %>
\ No newline at end of file

Copied: trunk/app/views/layouts/_tab_bar.rhtml (from rev 2789, branches/elico/app/views/layouts/_tab_bar.rhtml) (0 => 2790)


--- trunk/app/views/layouts/_tab_bar.rhtml	                        (rev 0)
+++ trunk/app/views/layouts/_tab_bar.rhtml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -0,0 +1,5 @@
+<div class="tabnav">
+  <% Conf.main_tabs.each do |tab| %>
+    <%= link_to(tab['label'], tab['link'], :class => "tab", :id => (tab['controller'] && controller.controller_name.match(tab['controller'])) ? 'selected_tabnav' : '') -%>
+  <% end %>
+</div>

Copied: trunk/app/views/layouts/_user_links.rhtml (from rev 2789, branches/elico/app/views/layouts/_user_links.rhtml) (0 => 2790)


--- trunk/app/views/layouts/_user_links.rhtml	                        (rev 0)
+++ trunk/app/views/layouts/_user_links.rhtml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -0,0 +1,8 @@
+<% if logged_in? -%>
+  <%= signout_link -%> |
+<% else -%>
+  <%= icon "login", new_session_url, nil, nil, "Log in" -%> |
+  <%= icon "user", new_user_url, nil, nil, "Register" -%> |
+<% end %>
+<%= icon "feedback", "/feedback", nil, nil, "Give us Feedback" -%> |
+<%= icon "user-invite", invite_users_path, nil, nil, "Invite" -%>
\ No newline at end of file

Modified: trunk/app/views/layouts/application.rhtml (2789 => 2790)


--- trunk/app/views/layouts/application.rhtml	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/app/views/layouts/application.rhtml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -1 +1,2 @@
-<%= render :partial => Conf.page_template %>
+<% configure_layout %>
+<%= render :partial => @layout["layout"] %>
\ No newline at end of file

Modified: trunk/config/base_schema.xml (2789 => 2790)


--- trunk/config/base_schema.xml	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/config/base_schema.xml	2011-11-09 10:26:44 UTC (rev 2790)
@@ -19,6 +19,7 @@
     <column type="string"   name="label"/>
     <column type="integer"  name="content_type_id"/>
     <column type="integer"  name="license_id"/>
+    <column type="string"   name="layout"/>
 
     <index>
       <column name="contributable_id"/>

Modified: trunk/config/environment.rb (2789 => 2790)


--- trunk/config/environment.rb	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/config/environment.rb	2011-11-09 10:26:44 UTC (rev 2790)
@@ -112,7 +112,6 @@
 
 load 'config/environment_private.rb' if FileTest.exist?('config/environment_private.rb')
 
-# Fix for Ruby 1.8.7 when using Rails < 2.2
 module ActionView
   module Helpers
     module TextHelper

Modified: trunk/lib/conf.rb (2789 => 2790)


--- trunk/lib/conf.rb	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/lib/conf.rb	2011-11-09 10:26:44 UTC (rev 2790)
@@ -165,6 +165,11 @@
     self.fetch_entry('recaptcha_private')
   end
 
+  def self.layouts
+    #TODO: Perhaps implement code that can load different/extra settings files based on current environment
+    self.fetch_entry('layouts').delete_if {|k,v| v["environment"] && (v["environment"] != ENV["RAILS_ENV"])}
+  end
+
   # This method is required to create an administrator in the test fixtures
 
   def self.admins=(value)

Copied: trunk/public/images/elico_back1.png (from rev 2789, branches/elico/public/images/elico_back1.png)


(Binary files differ)

Copied: trunk/public/images/elico_back2.png (from rev 2789, branches/elico/public/images/elico_back2.png)


(Binary files differ)

Copied: trunk/public/images/elico_back3.png (from rev 2789, branches/elico/public/images/elico_back3.png)


(Binary files differ)

Copied: trunk/public/images/elico_back4.png (from rev 2789, branches/elico/public/images/elico_back4.png)


(Binary files differ)

Copied: trunk/public/images/elico_logo_white.png (from rev 2789, branches/elico/public/images/elico_logo_white.png)


(Binary files differ)

Copied: trunk/public/images/logo_tiny.png (from rev 2789, branches/elico/public/images/logo_tiny.png)


(Binary files differ)

Copied: trunk/public/stylesheets/elico.css (from rev 2789, branches/elico/public/stylesheets/elico.css) (0 => 2790)


--- trunk/public/stylesheets/elico.css	                        (rev 0)
+++ trunk/public/stylesheets/elico.css	2011-11-09 10:26:44 UTC (rev 2790)
@@ -0,0 +1,59 @@
+/* Stylesheet for the e-LICO layout. Requires main myExperiment stylesheet. */
+
+body  {
+	background: #cfd5dd;
+}
+
+#myexp_searchbar, #myexp_sidebar, a.tab:hover, #selected_tabnav, .pagination a  {
+  background: #4d597e;
+}
+
+#elico_header
+{
+  background: url("/images/elico_back1.png") repeat-x scroll center top #2C3966;
+}
+
+#elico_links_bar
+{
+  width: 73.074em;
+  height: 32px;
+  margin: 0 auto;
+  padding: 0 1em;
+}
+
+#elico_links_bar #inner
+{
+  border: 1px solid #7D89BE;
+  background: #4D597E;
+  margin: 0 -1em;
+  padding: 0 1em;
+}
+
+.logo {
+  width: 73.074em;
+  float: none;
+  text-align: left;
+  color: white;
+  margin: 0 auto;
+  padding-top: 0.5em;
+}
+
+.links {
+  height: 2em;
+  padding: 0.5em;
+}
+
+.links a {
+  color: white;
+}
+
+/* IE7 fixes */
+#doc2 {
+  *overflow: hidden;
+  *height: 0px;
+}
+
+#elico_links_bar #inner {
+  *height: 100%;
+}
+/* end of IE7 fixes */

Modified: trunk/public/stylesheets/styles.css (2789 => 2790)


--- trunk/public/stylesheets/styles.css	2011-11-09 09:52:06 UTC (rev 2789)
+++ trunk/public/stylesheets/styles.css	2011-11-09 10:26:44 UTC (rev 2790)
@@ -7,7 +7,7 @@
    http://developer.yahoo.com/yui/fonts/#fontsize
 */
 body {
-	background: #8e8e8e url('/images/body-bg.gif') repeat-y center;
+	background: #8e8e8e;
 	/* Only need to define one font here because the 
 	   YUI Fonts CSS provides a degradation path
 	   (see: http://developer.yahoo.com/yui/fonts/) */
@@ -127,24 +127,36 @@
 
 #doc2 {
 	background-color: #FFFFFF;
+  padding: 0 1em;
 }
 
 #myexp_header {
-	margin: 1em 0.5em 0 0.5em;
+	margin: 0em 0.5em;
 }
 
-#myexp_header .logo {
+#hd
+{
+  padding-top: 1em;
+}
+
+.logo {
 	float: left;
 	width: 300px;
 }
 
-#myexp_header .links {
-	float: right;
-	width: 600px;
-	font-size: 93%;
+.links {
 	color: #999999;
+  font-weight: bold;
 }
 
+#site_info_links {
+  margin: 0.5em 0;
+}
+
+#user_links {
+  float: right;
+}
+
 #myexp_searchbar {
 	height: 20px;
 	text-align: center;
@@ -179,7 +191,7 @@
 /* Begin Footer styles */
 
 #ft {
-	margin: 2em 0;
+	margin-top: 2em;
 	border: 0px dotted #999999;
 	border-width: 1px 0 1px 0;
 	color: #333333;
@@ -284,6 +296,8 @@
 }
 
 /* begin css tabs nav */
+
+/* TODO: Remove me?
 .tabnav {
 	text-align: center;
 	font-weight: bolder;
@@ -330,8 +344,34 @@
 	background-color: #317eff;
 	background-image: none;
 	color: #FFFFFF;
+}   */
+
+.tabnav
+{
+  text-align: center;
+  margin: 0;
+  padding:  0;
 }
 
+a.tab {
+  display: inline-block;
+	padding: 4px 12px;
+	margin-left: 3px;
+	border-style: solid;
+  border-color: #BBBBBB;
+  border-width: 1px 1px 0px 1px;
+	text-decoration: none;
+	background: url('/images/tab-bg.png') top repeat-x #EDEDED;
+  color: #333333;
+	font-weight: bolder;
+	font-size: 108%;
+}
+
+a.tab:hover, #selected_tabnav {
+	color: #FFFFFF;
+	background: #317eff;
+}
+
 /* end css tabs nav */ 
 
 /* begin css breadcrumbs */
@@ -2285,3 +2325,16 @@
   vertical-align: middle;
 }
 
+#error_flash {
+  color: red;
+  font-weight: bold;
+  margin-bottom: 1.5em;
+  line-height: 1.4;
+}
+
+#notice_flash {
+  color: green;
+  font-weight: bold;
+  margin-bottom: 1.5em;
+  line-height: 1.4;
+}
\ No newline at end of file

reply via email to

[Prev in Thread] Current Thread [Next in Thread]