myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2155] branches/apace: adding app controller and


From: noreply
Subject: [myexperiment-hackers] [2155] branches/apace: adding app controller and views
Date: Wed, 1 Apr 2009 04:52:13 -0400 (EDT)

Revision
2155
Author
dgc
Date
2009-04-01 04:52:12 -0400 (Wed, 01 Apr 2009)

Log Message

adding app controller and views

Added Paths

Diff

Added: branches/apace/app/controllers/apps_controller.rb (0 => 2155)


--- branches/apace/app/controllers/apps_controller.rb	                        (rev 0)
+++ branches/apace/app/controllers/apps_controller.rb	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,311 @@
+# myExperiment: app/controllers/apps_controller.rb
+#
+# Copyright (c) 2007 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class AppsController < ApplicationController
+  before_filter :login_required,             :except => [:index, :show, :statistics, :search, :all]
+  before_filter :find_apps,                  : [:all]
+  before_filter :find_app_aux,               :except => [:search, :index, :new, :create, :all]
+  before_filter :create_empty_object,        : [:new, :create]
+  before_filter :set_sharing_mode_variables, : [:show, :new, :create, :edit, :update]
+  before_filter :check_can_edit,             : [:edit, :update]
+  
+  # declare sweepers and which actions should invoke them
+  cache_sweeper :blob_sweeper,             : [ :create, :update, :destroy ]
+  cache_sweeper :permission_sweeper,       : [ :create, :update, :destroy ]
+  cache_sweeper :bookmark_sweeper,         : [ :destroy, :favourite, :favourite_delete ]
+  cache_sweeper :tag_sweeper,              : [ :create, :update, :tag, :destroy ]
+  cache_sweeper :comment_sweeper,          : [ :comment, :comment_delete ]
+  cache_sweeper :rating_sweeper,           : [ :rate ]
+  
+  # GET /applications;search
+  def search
+    @query = params[:query] || ''
+    @query.strip!
+    
+    @contributables = (SOLR_ENABLE && address@hidden) ? App.find_by_solr(@query, :limit => 100).results : []
+    @total_count = (SOLR_ENABLE && address@hidden) ? App.count_by_solr(@query) : 0
+    
+    respond_to do |format|
+      format.html # search.rhtml
+    end
+  end
+  
+  # GET /applications
+  def index
+    respond_to do |format|
+      format.html # index.rhtml
+    end
+  end
+  
+  # GET /applications/all
+  def all
+    respond_to do |format|
+      format.html # all.rhtml
+    end
+  end
+  
+  # GET /applications/1
+  def show
+    if allow_statistics_logging(@contributable)
+      @viewing = Viewing.create(:contribution => @contributable.contribution, :user => (logged_in? ? current_user : nil), :user_agent => request.env['HTTP_USER_AGENT'], :accessed_from_site => accessed_from_website?())
+    end
+  end
+  
+  # GET /applications/new
+  def new
+  end
+  
+  # GET /applications/1;edit
+  def edit
+  end
+  
+  # POST /applications
+  def create
+  
+    @contributable = App.new(
+        :contributor => current_user,
+        :title       => params[:contributable][:title],
+        :description => params[:contributable][:description],
+        :license     => params[:contributable][:license])
+
+    if @contributable.save == false
+      render :action ="" "new"
+      return
+    end
+
+    if params[:contributable][:tag_list]
+      @contributable.tags_user_id = current_user
+      @contributable.tag_list = convert_tags_to_gem_format params[:contributable][:tag_list]
+      @contributable.update_tags
+    end
+
+    # update policy
+    @contributable.contribution.update_attributes(params[:contribution])
+  
+    policy_err_msg = update_policy(@contributable, params)
+  
+    update_credits(@contributable, params)
+    update_attributions(@contributable, params)
+  
+    if policy_err_msg.blank?
+      flash[:notice] = 'Application was successfully created.'
+      redirect_to application_url(@contributable)
+    else
+      flash[:notice] = "Application was successfully created. However some problems occurred, please see these below.</br></br><span style='color: red;'>" + policy_err_msg + "</span>"
+      redirect_to :controller => 'apps', :id => @contributable, :action ="" "edit"
+    end
+  end
+  
+  # PUT /applications/1
+  def update
+    # hack for select contributor form
+    if params[:contributor_pair]
+      params[:contribution][:contributor_type], params[:contribution][:contributor_id] = params[:contributor_pair][:class_id].split("-")
+      params.delete("contributor_pair")
+    end
+    
+    # remove protected columns
+    if params[:contributable]
+      [:contributor_id, :contributor_type, :content_type, :local_name, :created_at, :updated_at].each do |column_name|
+        params[:contributable].delete(column_name)
+      end
+    end
+    
+    respond_to do |format|
+      if @contributable.update_attributes(params[:contributable])
+        @contributable.refresh_tags(convert_tags_to_gem_format(params[:contributable][:tag_list]), current_user) if params[:contributable][:tag_list]
+        
+        policy_err_msg = update_policy(@contributable, params)
+        update_credits(@contributable, params)
+        update_attributions(@contributable, params)
+        
+        if policy_err_msg.blank?
+          flash[:notice] = 'Application was successfully updated.'
+          format.html { redirect_to application_url(@contributable) }
+        else
+          flash[:error] = policy_err_msg
+          format.html { redirect_to :controller => 'apps', :id => @contributable, :action ="" "edit" }
+        end
+      else
+        format.html { render :action ="" "edit" }
+      end
+    end
+  end
+  
+  # DELETE /applications/1
+  def destroy
+    success = @contributable.destroy
+
+    respond_to do |format|
+      if success
+        flash[:notice] = "Application has been deleted."
+        format.html { redirect_to applications_url }
+      else
+        flash[:error] = "Failed to delete Application. Please contact your administrator."
+        format.html { redirect_to application_url(@contributable) }
+      end
+    end
+  end
+  
+  # POST /applications/1;comment
+  def comment 
+    text = params[:comment][:comment]
+    
+    if text and text.length > 0
+      comment = Comment.create(:user => current_user, :comment => text)
+      @contributable.comments << comment
+    end
+    
+    respond_to do |format|
+      format.html { render :partial => "comments/comments", :locals => { :commentable => @contributable } }
+    end
+  end
+  
+  # DELETE /applications/1;comment_delete
+  def comment_delete
+    if params[:comment_id]
+      comment = Comment.find(params[:comment_id].to_i)
+      # security checks:
+      if comment.user_id == current_user.id and comment.commentable_type == 'App' and comment.commentable_id == @contributable.id
+        comment.destroy
+      end
+    end
+    
+    respond_to do |format|
+      format.html { render :partial => "comments/comments", :locals => { :commentable => @contributable } }
+    end
+  end
+  
+  # POST /applications/1;rate
+  def rate
+    if @contributable.contributor_type == 'User' and @contributable.contributor_id == current_user.id
+      error("You cannot rate your own content!", "")
+    else
+      Rating.delete_all(["rateable_type = ? AND rateable_id = ? AND user_id = ?", @contributable.class.to_s, @contributable.id, current_user.id])
+      
+      @contributable.ratings << Rating.create(:user => current_user, :rating => params[:rating])
+      
+      respond_to do |format|
+        format.html { 
+          render :update do |page|
+            page.replace_html "ratings_inner", :partial => "contributions/ratings_box_inner", :locals => { :contributable => @contributable, :controller_name => controller.controller_name }
+            page.replace_html "ratings_breakdown", :partial => "contributions/ratings_box_breakdown", :locals => { :contributable => @contributable }
+          end }
+      end
+    end
+  end
+  
+  # POST /applications/1;tag
+  def tag
+    @contributable.tags_user_id = current_user # acts_as_taggable_redux
+    @contributable.tag_list = "address@hidden, #{convert_tags_to_gem_format params[:tag_list]}" if params[:tag_list]
+    @contributable.update_tags # hack to get around acts_as_versioned
+    
+    respond_to do |format|
+      format.html { 
+        render :update do |page|
+          unique_tag_count = @contributable.tags.uniq.length
+          page.replace_html "mini_nav_tag_link", "(#{unique_tag_count})"
+          page.replace_html "tags_box_header_tag_count_span", "(#{unique_tag_count})"
+          page.replace_html "tags_inner_box", :partial => "tags/tags_box_inner", :locals => { :taggable => @contributable, :owner_id => @contributable.contributor_id } 
+        end
+      }
+    end
+  end
+  
+  # POST /applications/1;favourite
+  def favourite
+    @contributable.bookmarks << Bookmark.create(:user => current_user) unless @contributable.bookmarked_by_user?(current_user)
+    
+    respond_to do |format|
+      flash[:notice] = "You have successfully added this item to your favourites."
+      format.html { redirect_to application_url(@contributable) }
+    end
+  end
+  
+  # DELETE /applications/1;favourite_delete
+  def favourite_delete
+    @contributable.bookmarks.each do |b|
+      if b.user_id == current_user.id
+        b.destroy
+      end
+    end
+    
+    respond_to do |format|
+      flash[:notice] = "You have successfully removed this item from your favourites."
+      redirect_url = params[:return_to] ? params[:return_to] : application_url(@contributable)
+      format.html { redirect_to redirect_url }
+    end
+  end
+  
+  protected
+  
+  def find_apps
+    @contributables = App.find(:all, 
+                       :order => "created_at DESC",
+                       :page => { :size => 20, 
+                       :current => params[:page] })
+  end
+  
+  def find_app_aux
+    begin
+      app = App.find(params[:id])
+      
+      if Authorization.is_authorized?(action_name, nil, app, current_user)
+        @contributable = app
+        
+        @contributable_entry_url = url_for : false,
+                            :host => base_host,
+                            :id => @contributable.id
+
+      else
+        if logged_in? 
+          error("Application not found (id not authorized)", "is invalid (not authorized)")
+          return false
+        else
+          find_app_aux if login_required
+        end
+      end
+    rescue ActiveRecord::RecordNotFound
+      error("Application not found", "is invalid")
+      return false
+    end
+  end
+  
+  def create_empty_object
+    @contributable = App.new
+  end
+  
+  def set_sharing_mode_variables
+    case action_name
+      when "new"
+        @sharing_mode  = 0
+        @updating_mode = 6
+      when "create", "update"
+        @sharing_mode  = params[:sharing][:class_id].to_i if params[:sharing]
+        @updating_mode = params[:updating][:class_id].to_i if params[:updating]
+      when "show", "edit"
+        @sharing_mode  = @contributable.contribution.policy.share_mode
+        @updating_mode = @contributable.contribution.policy.update_mode
+    end
+  end
+
+  def check_can_edit
+    if @contributable && !Authorization.is_authorized?('edit', nil, @contributable, current_user)
+      error("You are not authorised to manage this Application", "")
+    end
+  end
+  
+  private
+  
+  def error(notice, message, attr=:id)
+    flash[:error] = notice
+     (err = App.new.errors).add(attr, message)
+    
+    respond_to do |format|
+      format.html { redirect_to applications_url }
+    end
+  end
+end

Added: branches/apace/app/views/apps/_all_tags.rhtml (0 => 2155)


--- branches/apace/app/views/apps/_all_tags.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/_all_tags.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,6 @@
+<% unless (tags = tags_for_type("App", 50)).empty? %>
+	<h2>Top <%= tags.length %> tags for Applications&nbsp&nbsp&nbsp<small>[<%= link_to "See All Tags", tags_path %>]</small></h2>
+    <%= tag_cloud_from_collection(tags, false, "apps") %>
+	<br/>
+	<br/>
+ <% end %>

Added: branches/apace/app/views/apps/_breadcrumbs.rhtml (0 => 2155)


--- branches/apace/app/views/apps/_breadcrumbs.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/_breadcrumbs.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,21 @@
+<li><%= link_to 'Applications', applications_path -%></li>
+
+<% if ["show", "new", "edit", "all", "search"].include? controller.action_name.to_s -%>
+  <li><b>&#187;</b></li>
+  
+  <% case controller.action_name.to_s; when "show" -%>
+    <li><%= contributable_name(@contributable.id, 'App') -%></li>
+  <% when "new" %>
+    <li>New Application</li>
+  <% when "edit" %>
+		<li><%= link_to "#{contributable_name(@contributable.id, 'App')}", application_path(@contributable) -%></li>
+		<li><b>&#187;</b></li>
+    <li>Manage</li>
+  <% when "all" %>
+    <li>All Applications</li>
+	<% when "search" %>  
+    <li>Search Results</li>
+  <% else %>
+    <!-- no breadcrumb -->
+  <% end %>
+<% end %>

Added: branches/apace/app/views/apps/_license_form.rhtml (0 => 2155)


--- branches/apace/app/views/apps/_license_form.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/_license_form.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,91 @@
+<% if params[:contributable] && !params[:contributable][:license].blank? %>
+	<% license = params[:contributable][:license] %>
+<% elsif edit %>
+	<% license = @contributable.license %>
+<% else %>
+ 	<% license = 'by-sa' %> 
+<% end %>
+
+<div class="fold">
+    <div class="foldTitle">
+      <%= info_icon_with_tooltip("This section allows you to specify the <strong>rights</strong> that people have when they download and use this File, by setting the license. <br/><br/>By default, the license specifies that people are allowed to build on this File as long as they give the original author credit and share their resulting work under the same conditions.") %>
+      License/Rights
+			<% if edit %>
+				<hr />
+				<small>Current: <%= license_link(license) %></small>
+			<% else %>
+				<hr />
+				<small>Default: people are allowed to build on this File, but must give author(s) credit and give attribution to this File. They must also share under the same conditions. (<%= license_link license %>)</small>
+			<% end %>
+    </div>
+    <div class="foldContent" style="display: none;">
+        <p class="box_infotext">
+            This section allows you to specify the <strong>rights</strong> that people have when they download and use this File, by setting the license.
+        </p>
+        <br />
+        <p>
+            <strong>What license do you want people to adhere to if they download and use this File?</strong>
+        </p>
+        <div style="padding-left: 1em;">
+            <div style="padding: 0.5em; border: 1px dotted #999999; margin: 1.5em 3em; text-align: center;">
+                <p style="text-align: center;">
+                    <img alt="Science Commons" src="" /></p>
+                <p style="text-align: center;">
+                    Below you can configure what rights people will have with this File, based on
+                    the <a href="" Commons</a>
+                    licenses. Sharing Files and letting others build upon them is a useful contribution
+                    and is highly recommended.</p>
+            </div>
+            <p>
+                When someone downloads this Files, are they allowed to build upon it (such as
+                extend, reuse, repurpose etc)?
+			</p>
+            <table style="border-collapse: collapse; border-spacing: 0;">
+            	<tbody>
+            		<tr>
+						<td style="vertical-align: top; text-align: center;">
+			                <input <%= 'checked="checked"' if (license == 'by-sa') %> name="contributable[license]" type="radio" value="by-sa"/>
+						</td>
+						<td style="vertical-align: top; text-align: left;">
+			                <p style="padding: 0; margin: 0;">
+			                	Yes, as long as they <strong>give the author(s) credit</strong> and <strong>give attribution to this File</strong>. 
+								They must also <strong>share</strong> the resulting work <strong>under the same conditions</strong>.
+								<br/>
+								- <%= license_link "by-sa" %>
+							</p>
+						</td>
+            		</tr>
+					<tr>
+						<td style="vertical-align: top; text-align: center;">
+                			<input <%= 'checked="checked"' if (license == 'by') %> name="contributable[license]" type="radio" value="by"/>
+						</td>
+						<td style="vertical-align: top; text-align: left;">	
+            				<p style="padding: 0; margin: 0;">
+            					Yes, as long as they <strong>give the author(s) credit</strong> and <strong>give attribution to this File</strong>.
+								<br/>
+								- <%= license_link "by" %>
+							</p>
+						</td>
+            		</tr>
+					<tr>
+						<td style="vertical-align: top; text-align: center;">
+                			<input <%= 'checked="checked"' if (license == 'by-nd') %> name="contributable[license]" type="radio" value="by-nd"/>
+						</td>
+						<td style="vertical-align: top; text-align: left;">
+            				<p style="padding: 0; margin: 0;">
+								No. They may only use the File for reference.
+								<br/>
+								- <%= license_link "by-nd" %>
+							</p>
+						</td>
+            		</tr>
+            	</tbody>
+        	</table>
+                <small>Nothing in these licenses impairs or restricts the author's moral rights.</small></p>
+        </div>
+    </div>
+</div>
+                
+
+                
+                

Added: branches/apace/app/views/apps/_table.rhtml (0 => 2155)


--- branches/apace/app/views/apps/_table.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/_table.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,98 @@
+<% query ||= false -%>
+<% odd_row = false -%>
+<% unless collection.empty? %>
+
+<table class="alt_table">
+	<% for contributable in collection %>
+		<% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
+		<% if collection.size == 1 -%>
+			<% show ||= Authorization.is_authorized?('show', nil, contributable, current_user) -%>
+		<% else -%>
+			<% show = Authorization.is_authorized?('show', nil, contributable, current_user) -%>
+		<% end -%>
+	  <% if show -%>
+			<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
+				<% cache(:controller => 'files_cache', :action ="" 'listing', :id => contributable.id) do -%>
+					<td style="width: 100px;">
+						<p style="margin-top:0; padding-top:0; text-align: center;"><b>Uploader:</b></p>
+						<center><%= contributor(contributable.contribution.contributor_id, contributable.contribution.contributor_type, true, 60) %></center>
+					</td>
+					<td style="text-align: left;">
+						<p class="title">
+							<%= icon "app", nil, nil, nil, '' %>
+							<% title = contributable_name(contributable.id, 'App') %>
+							<%=link_to(query ? highlight_all(title, query) : title, application_path(contributable)) %>
+						</p>
+						
+						<p style="font-size: 85%; margin-top: 0; padding-top: 0;">
+							<b>Created:</b> <%=datetime contributable.contribution.created_at, false %>
+							<% unless contributable.contribution.created_at == contributable.contribution.updated_at %>
+								|	<b>Last updated:</b> <%=datetime contributable.contribution.updated_at, false %>
+							<% end %>
+						</p>
+						
+						<% unless (creditors = contributable.creditors).empty? %>
+							<p style="font-size:85%;">
+							<b>Credits:</b>
+							<% creditors.each do |c| %>
+								<% if c.creditor_type == 'User' %>
+									<%= icon('user', nil, nil, nil, '') %> 
+								<% elsif c.creditor_type == 'Network' %>
+									<%= icon('network-member', nil, nil, nil, '') %>
+								<% end %>
+								<%= contributor(c.creditor_id, c.creditor_type) %>
+							<% end %>
+							</p>
+						<% end %>
+						<% unless (attributors = contributable.attributors).empty? %>
+							<p style="font-size:85%;">
+							<b>Attributions:</b>
+							<% attributors.each do |a| %>
+								<% if Authorization.is_authorized?("show", nil, a.attributor, current_user) -%>
+									<% if a.attributor_type == 'Workflow' %>
+										<%= icon('workflow', nil, nil, nil, '') %> 
+									<% elsif a.attributor_type == 'App' %>
+										<%= icon('app', nil, nil, nil, '') %>
+									<% end %>
+									<%= contributable(a.attributor_id, a.attributor_type) %>
+								<% end -%>
+							<% end %>
+							</p>
+						<% end %>
+						
+						<p style="font-size:85%;"><b>License: </b><%= license_link contributable.license.to_s %></p>
+						
+						<div class="desc" style="font-size: 85%;">
+							<% if contributable.description and contributable.description.length > 0 %>
+					  		<% desc = truncate(strip_html(contributable.description), 500) %>
+					    	<%= query ? highlight_all(desc, query) : desc %>
+						  <% else -%>
+								<span class="none_text">No description</span>	
+							<% end %>
+						</div>
+						
+						<p style="font-size: 85%;">
+							<a href="" application_path(contributable) + '#ratings' -%>"><b>Rating: </b><%= number_with_precision(contributable.rating, 1) %> / 5 (<%= pluralize contributable.ratings_count, 'rating' %>)</a> |
+							<a href="" application_path(contributable) + '#comments' -%>"><b>Comments: </b><%= contributable.comments_count %></a> |
+							<b>Viewed internally:</b> <%= pluralize Viewing.total_site_viewings_count_for_contribution(contributable.contribution.id), "time" %>
+						</p>
+						
+						<% unless (tags = contributable.tags).empty? %>
+							<a href="" application_path(contributable) + '#tags' -%>"><p style="font-size: 85%;"><b>Tags:</b></p></a>
+							<div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
+						<% else %>
+							<p style="font-size: 85%;"><i>This File has no tags!</i></p>
+						<% end %>	
+					</td>
+				<% end %>
+					
+					<td class="actions" style="width: 80px;">
+				    <%= icon "show", application_path(contributable), nil, nil, "View" %>
+				    <% if mine?(contributable) %><%= icon "manage", edit_file_path(contributable), nil, nil, "Manage" %><% end %>
+				  </td>
+			</tr>
+		<% end %>
+	<% end %>
+</table>
+
+<% end %>

Added: branches/apace/app/views/apps/all.rhtml (0 => 2155)


--- branches/apace/app/views/apps/all.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/all.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,9 @@
+<% t "All" -%>
+
+<h2>All Applications</h2>
+
+<%= render :partial => "layouts/paginate", :locals => { :collection => @contributables } %>
+
+<%= render :partial => "apps/table", :locals => { :collection => @contributables } %>
+
+<%= render :partial => "layouts/paginate", :locals => { :collection => @contributables } %>

Added: branches/apace/app/views/apps/edit.rhtml (0 => 2155)


--- branches/apace/app/views/apps/edit.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/edit.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,44 @@
+<% t "Manage" -%>
+
+<%= _javascript__include_tag :fckeditor %>
+<%= _javascript__include_tag "osp.js" %>
+
+<h1>Manage Application: <%= contributable_name(@contributable.id, 'App') %></h1>
+
+<%= error_messages_for :contributable %>
+
+<% form_for(:contributable, :url ="" application_path(@contributable), :html => { :method => :put }) do |f| %>
+
+  <p style="text-align: center;">
+  	<strong>Title: </strong>
+	<br/>
+	<%= f.text_field :title, :size => 60 %>
+  </p>
+	
+	<br/>
+  
+  <p style="text-align: center;">
+  	<strong>Description: </strong>
+	</p>
+	<center>
+		<%= fckeditor_textarea(:contributable, :description, :toolbarSet => 'Simple', :width => '600px', :height => '300px') %>
+	</center>
+  
+  <br/>
+
+  <%= render :partial => "tags/tags_form", :locals => { :edit => true, :taggable => @contributable } %>
+  
+  <%= render :partial => "contributions/credit_attribution_form", :locals => { :edit => true, :contributable => @contributable } %>
+
+  <% if Authorization.is_authorized?("edit", nil, @contributable, current_user) %>
+  	<%= render :partial => "contributions/sharing_form",  :locals => { :edit => true, :contributable => @contributable, :update_perms => true } %>
+	<%= render :partial => "apps/license_form", :locals => { :edit => true } %>
+  <% end %>
+
+  <p>
+    <center>
+    	<%= submit_tag "Update",:disable_with => "Updating..." %> 
+		or <%= link_to "Cancel", application_path(@contributable) %>
+	</center>
+  </p>
+<% end %>

Added: branches/apace/app/views/apps/index.rhtml (0 => 2155)


--- branches/apace/app/views/apps/index.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/index.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,10 @@
+<ul class="sectionIcons">
+	<li><%= icon "app", new_application_path, nil, nil, "Register new Applications" %></li>
+	<li><%= icon "view-all", all_applications_path, nil, nil, "View all Applications" %></li>
+</ul>
+
+<% cache(:controller => 'apps', :action ="" 'all_tags') do -%>
+	<%= render :partial => "apps/all_tags" %>
+<% end -%>
+
+<%= render :partial => "contributions/most_tabs", :locals => { :type => "App" } %>

Added: branches/apace/app/views/apps/new.rhtml (0 => 2155)


--- branches/apace/app/views/apps/new.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/new.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,47 @@
+<% t "New" -%>
+
+<%= _javascript__include_tag :fckeditor %>
+<%= _javascript__include_tag "osp.js" %>
+
+<h1>New Application</h1>
+
+<%= error_messages_for :contributable %>
+
+<% form_tag({ :action ="" :create }, :multipart => true) do %>
+
+  <p style="text-align: center;">
+    <strong>Title: </strong>
+    <br/>
+    <%= text_field_tag "contributable[title]", @contributable.title, :size => 60 %>
+  </p>
+
+  <br/>
+
+  <p style="text-align: center;">
+    <strong>Description:</strong>
+  </p>
+
+  <center>
+    <%= fckeditor_textarea(:contributable, :description, :toolbarSet => 'Simple', :width => '600px', :height => '300px') %>
+  </center>
+
+  <br />
+
+  <%= render :partial => "tags/tags_form", :locals => { :edit => false, :taggable => @contributable } %>
+
+  <%= render :partial => "contributions/credit_attribution_form", :locals => { :edit => false, :contributable => @contributable } %>
+
+  <%= render :partial => "contributions/sharing_form",  :locals => { :edit => false, :contributable => @contributable, :update_perms => true } %>
+
+  <%= render :partial => "apps/license_form", :locals => { :edit => false } %>
+
+  <%= render :partial => 'contributions/terms_and_conditions' %>
+
+  <br/>
+  
+  <p style="text-align: center;">
+    <%= submit_tag "Save", :disable_with => "Saving..." %>
+  </p>
+
+<% end %>
+

Added: branches/apace/app/views/apps/search.rhtml (0 => 2155)


--- branches/apace/app/views/apps/search.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/search.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,12 @@
+<% t "Search" -%>
+
+<h1>Search Results</h1>
+
+<h2>Showing <%= pluralize(@contributables.length, "application") %> of <%= @total_count -%> found for <%= @query ? "\"address@hidden"" : "" %></h2>
+
+<%= view_privileges_notice %>
+<br/>
+
+<%= render :partial => "apps/table", :locals => { :collection => @contributables } %>
+
+<br />

Added: branches/apace/app/views/apps/show.rhtml (0 => 2155)


--- branches/apace/app/views/apps/show.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/show.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1,145 @@
+<% t "#{contributable_name(@contributable.id, 'App')} (#{h @contributable.contributor_name})" -%>
+
+<ul class="sectionIcons">
+	<% if Authorization.is_authorized?('edit', nil, @contributable, current_user) -%>
+		<li><%= icon('manage', edit_application_path(@contributable), nil, nil, 'Manage Application Entry')%></li>
+	<% end -%>
+	<% if Authorization.is_authorized?('destroy', nil, @contributable, current_user) %>
+		<li><%= icon('destroy', application_path(@contributable), nil, { :confirm => 'This deletes the Application and all metadata such as tags, comments and ratings. Are you sure?', :method => :delete }, 'Delete Application Entry') %></li>
+	<% end %>
+</ul>
+
+<h1 class="contribution_title">Application Entry: <%= contributable_name(@contributable.id, 'App') %></h1>
+
+<%= render :partial => "contributions/datetime_info", :locals => { :contributable => @contributable } -%>
+
+<div class="contribution_mini_nav">
+	|
+	<%= link_to "License", "#license" %>
+	|
+	<%= link_to "Credits (address@hidden)", "#credits" %>
+	|
+	<%= link_to "Attributions (address@hidden)", "#attributions" %>
+	|
+	<%= link_to "Tags <span id='mini_nav_tag_link'>(address@hidden)</span>", "#tags" %>
+	|
+	<%= link_to "Featured in Packs (#{Pack.packs_with_contributable(@contributable).length})", "#featured_in_packs" %>
+	|
+	<%= link_to "Ratings (address@hidden)", "#ratings" %>
+	|
+	<%= link_to "Attributed By (address@hidden)", "#attributed_by" %>
+	|
+	<%= link_to "Favourited By (address@hidden)", "#favourited_by" %>
+	| 
+	<% if logged_in? and @contributable.owner?(current_user) %>
+	  <br/>
+	  |
+		<!-- NB! Index of the 'sharing' tab might change! -->
+	  <a href="" 
+	  |
+	<% end %>
+	<%= link_to "Comments (address@hidden)", "#comments" %> 
+	|
+</div>
+
+<div class="contribution_left_box">
+	<div class="contribution_version_box">
+		<div class="contribution_version_inner_box">
+			<p>
+			    <b>Title:</b>
+			    <span class="title"><%=h @contributable.title %></span>
+			</p>
+			
+			<h3>
+				<%= info_icon_with_tooltip("This section shows the overall description for this Application") %>
+				Description
+			</h3>
+			
+			<% unless @contributable.description.blank? %>
+				<div class="contribution_description">
+					<%= @contributable.description_html %>
+				</div>
+			<% else %>
+				<p class="none_text">
+					Not set
+				</p>
+			<% end %>
+		</div>
+	
+	</div>
+
+</div>
+
+<div class="contribution_right_box">
+	<%= render :partial => "contributions/uploader_box", :locals => { :contributable => @contributable } %>
+	
+	<%= render :partial => "contributions/license_box", :locals => { :contributable => @contributable } %>
+	
+	<%= render :partial => "contributions/credits_attributions_box", :locals => { :contributable => @contributable, :edit_path => edit_application_path(@contributable) } %>
+	
+	<%= render :partial => "tags/tags_box", :locals => { :taggable => @contributable, 
+																											 :owner_id => ((@contributable.contributor_type == 'User') ? @contributable.contributor_id : nil), 
+																											 :add_path => tag_application_path(@contributable), 
+																											 :edit_path => edit_application_path(@contributable),
+																											 :allow_edit => Authorization.is_authorized?('edit', nil, @contributable, current_user) } %>
+																											 
+  <%= render :partial => "contributions/shared_with_groups_box", :locals => { :contributable => @contributable } %>
+	
+	<%= render :partial => "contributions/in_packs_box", :locals => { :contributable => @contributable, :contributable_url => @contributable_entry_url } %>
+	
+	<%= render :partial => "contributions/ratings_box", :locals => { :contributable => @contributable } %>
+	
+	<%= render :partial => "contributions/attributed_by", :locals => { :contributable => @contributable } %>
+	
+	<%= render :partial => "contributions/favourited_box", :locals => { :contributable => @contributable,
+																																			:add_to_favourites_path => favourite_application_url(@contributable),
+																																			:remove_from_favourites_path => favourite_delete_application_url(@contributable) } %>
+	
+	<%= render :partial => "contributions/statistics_box", :locals => { :contributable => @contributable } %>
+</div>	
+
+<div class="clearer">&nbsp;</div>
+
+<!-- BEGIN tabs -->
+	
+<br/>
+
+<div id="tabsContainer" class="tabsContainer"></div>
+	
+<% if logged_in? and @contributable.owner? current_user %>
+  
+	<a name="sharing"></a>
+	<div class="tabContainer">
+    <div class="tabTitle">Sharing</div>
+    <div class="tabContent">
+
+      <%= render :partial => "contributions/sharing_summary",  :locals => { :contributable => @contributable } %>
+      <%= render :partial => "contributions/updating_summary", :locals => { :contributable => @contributable } %>
+	  
+      <% if Authorization.is_authorized?('edit', nil, @contributable, current_user) %>
+        <ul class="sectionIcons">
+          <li><%= icon('edit', edit_application_path(@contributable), nil, nil, 'Edit')%></li>
+        </ul>
+      <% end %>
+    </div>
+  </div>
+	
+	<% if false %>
+  <div class="tabContainer">
+    <div class="tabTitle">Viewing History</div>
+    <div class="tabContent">
+      <%= render :partial => "contributions/history", :object => @contributable.contribution %>
+    </div>
+  </div>
+	<% end %>
+	
+<% end %>
+
+<!-- END tabs -->
+
+<br/>
+<br/>
+
+<div id="commentsBox">
+	<%= render :partial => "comments/comments", :locals => { :commentable => @contributable } %>
+</div>

Added: branches/apace/app/views/apps/statistics.rhtml (0 => 2155)


--- branches/apace/app/views/apps/statistics.rhtml	                        (rev 0)
+++ branches/apace/app/views/apps/statistics.rhtml	2009-04-01 08:52:12 UTC (rev 2155)
@@ -0,0 +1 @@
+<%= render :partial => "contributions/statistics_detailed", :locals => { :contributable => @blob } %>
\ No newline at end of file

Added: branches/apace/public/images/logo.jpg


(Binary files differ)
Property changes on: branches/apace/public/images/logo.jpg ___________________________________________________________________

Added: svn:executable

Added: svn:mime-type


reply via email to

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