Newer
Older
dmpopidor / app / views / dmptemplates / _versions_table.html.erb
@Marta Ribeiro Marta Ribeiro on 3 Jun 2016 3 KB DMPonline4 - RAILS 4.0 (#4)
<%if !phase.versions.nil? then %>
	<div class="versions_display_table">	
		<h3><%= t('org_admin.templates.versions_label')%></h3>
		<p>
			<%= t('org_admin.versions.versions_text_html')%>
		</p>
		<!--table displaying versions for this phase-->
		<table class="dmp_table" id="dmp_table">
			<thead>
				<tr>
					<th><%= t('org_admin.templates.title_label')%></th>
					<th><%= t('org_admin.templates.published_label')%></th>
					<th><%= t('org_admin.templates.created')%></th>
					<th><%= t('org_admin.templates.last_updated') %></th>
					<th><%= t('org_admin.templates.actions') %></th>
				</tr>
			</thead>
			<tbody>
				<% phase.versions.each do |v|%>
					<!--Alert pop up block for version editing-->
					<div id='version_edit_alert_<%= v.id%>' data-container="body" data-id="<%= v.id%>" data-backdrop='static' class='modal hide fade'>
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
							<h3><%= t('org_admin.versions.edit_alert_label')%></h3>
						</div>
						<div class="modal-body">
							<div><p><%= t('org_admin.versions.edit_alert_text')%></p></div>
						</div>
						<div class="modal-footer">
						  	<%= link_to t('org_admin.versions.edit_versions_label'), admin_phase_dmptemplate_path( :version_id => v.id, :id => phase.id , :edit => 'true') , :id => "edit-version-confirmed", :class => "btn cancel" %>
							<%= link_to t('org_admin.versions.clone_versions_label'), admin_cloneversion_dmptemplate_path( :version_id => v.id, :phase => phase ) , :id => "clone-version-confirmed", :class => "btn btn-primary" %>
					  </div>
					</div>
					<tr>
						<td class="dmp_td_no_border">
							<%= v.title %>
						</td>
						<td class="dmp_td_border">
							<%= v.published %>
						</td>
						<td class="dmp_td_border">
							<%= l v.created_at.to_date, :formats => :short %>
						</td>
						<td class="dmp_td_border">
							<%= l v.updated_at.to_date, :formats => :short %>
						</td>  
						<td class="dmp_td_border">
							<%= link_to t("helpers.view"), admin_phase_dmptemplate_path( :version_id => v.id, :id => phase.id , :edit => 'false'), :class => "dmp_table_link"%>
							<% if v.published? then%>
								<a id="edit-version-button" data-toggle="modal" href="#version_edit_alert_<%= v.id%>" class="dmp_table_link " >
									<%= t('org_admin.versions.edit_label')%>
								</a>
                                <%= link_to t("helpers.preview"), admin_previewphase_dmptemplate_path(v), :class => "dmp_table_link" %>
							<%else%>
								<%= link_to t("org_admin.versions.edit_label"), admin_phase_dmptemplate_path(phase, :version_id => v.id, :edit => 'true'), :class => "dmp_table_link" %>
                                <%= link_to t("helpers.preview"), admin_previewphase_dmptemplate_path(v), :class => "dmp_table_link" %>
								<%#= link_to t("helpers.submit.delete"), admin_destroyversion_dmptemplate_path(:version_id => v.id, :phase => phase , :edit => 'false'),
								:confirm => t("org_admin.versions.delete_message", :version_title => v.title ), :method => :delete, :class => "dmp_table_link"%>
							<%end%>		
						</td>	
					</tr>
					
					
									
				<%end%>
			</tbody>
		</table>
	</div>



<%end%>