Newer
Older
dmpopidor / app / views / dmptemplates / admin_phase.html.erb
@Marta Ribeiro Marta Ribeiro on 3 Jun 2016 3 KB DMPonline4 - RAILS 4.0 (#4)
<%- model_class = Phase -%>
<%= stylesheet_link_tag "admin" %>
<% javascript 'admin.js' %>

<h1>
	<%= @phase.dmptemplate.title %>
	<!-- link button to add new guidance -->
	<div class="move_2_right">
		<%= link_to t("org_admin.templates.view_all_templates"),
		            admin_index_dmptemplate_path,
		            :class => 'btn btn-primary' %>
	</div>            
</h1>

<div class="div_clear"></div>

<!-- render navigation tabs for the template-->
<%= render :partial => "admin_nav_tabs", locals: {dmptemplate: @phase.dmptemplate, active: @phase.id} %>

<!-- phase main container -->
<div class="project-tabs-body">
    <div class="accordion" id="sections-accordion">
   
       	<!--phase details -->
    	<div class="phase_details">
    		<div class="phase_details_body">
    			
                <!-- display phase details-->
    			<div id="show_phase_div">
    				<%= render :partial => "show_phase", locals: {phase: @phase}%>
    			</div>
    			<% if @phase.dmptemplate.org_type != t("helpers.org_type.funder") || current_user.org_type == t("helpers.org_type.funder") then %>
	    			<div id="edit_phase_div" style="display: none">
	    				<%= render :partial => "edit_phase", locals: {phase: @phase}%>
	    			</div>
	  
	  				<!--display all versions and their status for that phase-->
	    			<%= render :partial => "versions_table", locals: {phase: @phase}%>
	    		<%end%>	
    			
    			<!--display the more recent published version.  -->
	    		<% if @edit == "false" || (@phase.dmptemplate.org_type == t("helpers.org_type.funder") && current_user.org_type != t("helpers.org_type.funder")) then%>					
					<%= render :partial => 'show_version', locals: {version: @version}%>
				<%elsif @edit == "true" || current_user.org_type ==  t("helpers.org_type.funder") then %>	
					<%= render :partial => 'edit_version', locals: {version: @version, edit: @edit, phase: @phase} %>
				<%end%>	
			</div>
		</div>
		
		<!-- sections, questions and guidance details-->
		<% @sections.order("number ASC").each do |section| %>
			<%if (@edit == "true" && section.organisation_id == current_user.organisation_id) || 
            (@phase.dmptemplate.org_type == t("helpers.org_type.funder") && section.organisation_id == current_user.organisation_id && current_user.org_type != t("helpers.org_type.funder"))then%>
				<%= render :partial => 'edit_section', locals: {section: section, edit: @edit, phase: @phase, version: @version} %>
			<%elsif (section.organisation_id == @phase.dmptemplate.organisation_id ) || ( section.organisation_id == current_user.organisation_id) then%>
				<%= render :partial => 'show_section', locals: {section: section}%>
			<%end%>	
		 <% end %>
		 	
	</div>	
</div>
			
	
	<!-- Add a new section if the version is not published-->
	<% if !@version.published? || (@phase.dmptemplate.org_type == t("helpers.org_type.funder") && current_user.org_type != t("helpers.org_type.funder"))then %>
	
		<!-- add section block -->
		<div id="add_section_block_div" style="display: none">
			<%= render :partial => 'add_section', locals: {version: @version} %>
		</div>
		
		<!-- add section button-->
		<div id="add_section_button_div">
			<div class="div_right">
				<%= link_to t('org_admin.add_section_label'),'#', :id => 'add_section_button', :class =>'btn btn-primary' %> 
			</div>
		</div>		
	<%end%> 
		    	
		    	    
<%= tinymce :content_css => asset_path('application.css') %>