mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-21 21:40:48 +02:00
fix #1256 by changing the layout of the context view to match the project view
This commit is contained in:
parent
f9232a7e9d
commit
dea8734498
9 changed files with 57 additions and 63 deletions
|
@ -120,18 +120,6 @@ module ApplicationHelper
|
|||
link_to( descriptor, project, :title => "View project: #{project.name}" )
|
||||
end
|
||||
|
||||
def link_to_edit_project (project, descriptor = sanitize(project.name))
|
||||
link_to(descriptor,
|
||||
url_for({:controller => 'projects', :action => 'edit', :id => project.id}),
|
||||
{:id => "link_edit_#{dom_id(project)}", :class => "project_edit_settings icon"})
|
||||
end
|
||||
|
||||
def link_to_edit_context (context, descriptor = sanitize(context.name))
|
||||
link_to(descriptor,
|
||||
url_for({:controller => 'contexts', :action => 'edit', :id => context.id}),
|
||||
{:id => "link_edit_#{dom_id(context)}", :class => "context_edit_settings"})
|
||||
end
|
||||
|
||||
def link_to_edit_note (note, descriptor = sanitize(note.id.to_s))
|
||||
link_to(descriptor,
|
||||
url_for({:controller => 'notes', :action => 'edit', :id => note.id}),
|
||||
|
|
|
@ -1,30 +1,38 @@
|
|||
module ContextsHelper
|
||||
|
||||
def get_listing_sortable_options
|
||||
{
|
||||
:tag => 'div',
|
||||
:handle => 'handle',
|
||||
:complete => visual_effect(:highlight, 'list-contexts'),
|
||||
:url => order_contexts_path
|
||||
}
|
||||
end
|
||||
|
||||
def link_to_delete_context(context, descriptor = sanitize(context.name))
|
||||
link_to(descriptor,
|
||||
context_path(context, :format => 'js'),
|
||||
{
|
||||
:id => "delete_context_#{context.id}",
|
||||
:class => "delete_context_button icon",
|
||||
:x_confirm_message => t('contexts.delete_context_confirmation', :name => context.name),
|
||||
:title => t('contexts.delete_context_title')
|
||||
})
|
||||
end
|
||||
|
||||
def get_listing_sortable_options
|
||||
{
|
||||
:tag => 'div',
|
||||
:handle => 'handle',
|
||||
:complete => visual_effect(:highlight, 'list-contexts'),
|
||||
:url => order_contexts_path
|
||||
}
|
||||
end
|
||||
def link_to_edit_context (context, descriptor = sanitize(context.name))
|
||||
link_to(descriptor,
|
||||
url_for({:controller => 'contexts', :action => 'edit', :id => context.id}),
|
||||
{
|
||||
:id => "link_edit_#{dom_id(context)}",
|
||||
:class => "context_edit_settings icon"
|
||||
})
|
||||
end
|
||||
|
||||
def link_to_delete_context(context, descriptor = sanitize(context.name))
|
||||
link_to(
|
||||
descriptor,
|
||||
context_path(context, :format => 'js'),
|
||||
{
|
||||
:id => "delete_context_#{context.id}",
|
||||
:class => "delete_context_button",
|
||||
:x_confirm_message => t('contexts.delete_context_confirmation', :name => context.name),
|
||||
:title => t('contexts.delete_context_title')
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
def summary(context, undone_todo_count)
|
||||
content_tag(:p, "#{undone_todo_count}. Context is #{context.hidden? ? 'Hidden' : 'Active'}.")
|
||||
end
|
||||
|
||||
def summary(context, undone_todo_count)
|
||||
content_tag(:p, "#{undone_todo_count}. Context is #{context.hidden? ? 'Hidden' : 'Active'}.")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -58,6 +58,15 @@ module ProjectsHelper
|
|||
)
|
||||
end
|
||||
|
||||
def link_to_edit_project (project, descriptor = sanitize(project.name))
|
||||
link_to(descriptor,
|
||||
url_for({:controller => 'projects', :action => 'edit', :id => project.id}),
|
||||
{
|
||||
:id => "link_edit_#{dom_id(project)}",
|
||||
:class => "project_edit_settings icon"
|
||||
})
|
||||
end
|
||||
|
||||
def summary(project)
|
||||
project_description = ''
|
||||
project_description += sanitize(markdown( project.description )) unless project.description.blank?
|
||||
|
|
|
@ -1,29 +1,17 @@
|
|||
<% context = context_listing
|
||||
<%
|
||||
context = context_listing
|
||||
suppress_drag_handle ||= false
|
||||
suppress_edit_button ||= false
|
||||
suppress_delete_button ||= false
|
||||
%>
|
||||
<div id="<%= dom_id(context, "container") %>" class="list">
|
||||
<div id="<%= dom_id(context) %>" class="context sortable_row" style="display:'';">
|
||||
<% unless suppress_drag_handle -%>
|
||||
<div class="position">
|
||||
<span class="handle"><%= t('common.drag_handle') %></span>
|
||||
</div>
|
||||
<% end -%>
|
||||
<div class="data">
|
||||
<div id="<%= dom_id(context) %>" class="context sortable_row" style="display:block">
|
||||
<%= suppress_delete_button ? "" : link_to_delete_context(context, image_tag( "blank.png", :title => t('contexts.delete_context'), :class=>"delete_item")) -%>
|
||||
<%= suppress_edit_button ? "" : link_to_edit_context(context, image_tag( "blank.png", :title => t('contexts.edit_context'), :class=>"edit_item")) -%>
|
||||
<%= suppress_drag_handle ? "" : image_tag('grip.png', :width => '7', :height => '16', :border => '0', :title => t('common.drag_handle'), :class => 'grip')-%>
|
||||
<div class="context_description">
|
||||
<%= link_to_context( context ) %> <%= " (" + count_undone_todos_phrase(context,"actions") + ")" %>
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<% if context.hide? %>
|
||||
<span class="grey"><%= t('states.hidden') %></span>
|
||||
<% else %>
|
||||
<span class="grey"><%= t('states.visible') %></span>
|
||||
<% end %>
|
||||
|
||||
<%= link_to_delete_context(context, image_tag( "blank.png", :title => t('contexts.delete_context'), :class=>"delete_item")) %>
|
||||
<%= suppress_edit_button ? "" : link_to_edit_context(context, image_tag( "blank.png", :title => t('contexts.edit_context'), :class=>"edit_item")) %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="<%= dom_id(context, 'edit') %>" class="edit-form" style="display:none;">
|
||||
</div>
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
<span id="<%= state %>-contexts-count" class="badge"><%= context_state_group.length %></span>
|
||||
<%= t("states."+ state +"_plural")%> <%= t('common.contexts') %>
|
||||
</h2>
|
||||
|
||||
<div id="<%= state%>-contexts-empty-nd" style="<%= no_contexts ? 'display:block' : 'display:none'%>">
|
||||
<div class="message"><p><%= t('contexts.no_contexts_' + state) %></p></div>
|
||||
</div>
|
||||
|
||||
<div id="list-contexts-<%= state %>">
|
||||
<%= render :partial => 'context_listing', :collection => context_state_group %>
|
||||
</div>
|
||||
|
|
|
@ -8,9 +8,7 @@ suppress_delete_button ||= false
|
|||
<div id="<%= dom_id(project) %>" class="project sortable_row" style="display:block">
|
||||
<%= suppress_delete_button ? "" : link_to_delete_project(project, image_tag( "blank.png", :title => t('projects.delete_project_title'), :class=>"delete_item")) %>
|
||||
<%= suppress_edit_button ? "" : link_to_edit_project(project, image_tag( "blank.png", :title => t('projects.edit_project_title'), :class=>"edit_item")) %>
|
||||
<%= image_tag('grip.png',
|
||||
:width => '7', :height => '16', :border => '0',
|
||||
:title => t('common.drag_handle'), :class => 'grip') unless suppress_drag_handle -%>
|
||||
<%= suppress_drag_handle ? "" : image_tag('grip.png', :width => '7', :height => '16', :border => '0', :title => t('common.drag_handle'), :class => 'grip') -%>
|
||||
<div class="project_description">
|
||||
<span class="<%= needsreview_class( project ) %>">
|
||||
<%= link_to_project( project ) %>
|
||||
|
|
|
@ -44,7 +44,7 @@ When /^I drag context "([^"]*)" above context "([^"]*)"$/ do |context_drag, cont
|
|||
drag_index = context_list_find_index(context_drag)
|
||||
drop_index = context_list_find_index(context_drop)
|
||||
|
||||
page.execute_script "$('#{sortable_css}').simulateDragSortable({move: #{drop_index-drag_index}, handle: '.handle'});"
|
||||
page.execute_script "$('#{sortable_css}').simulateDragSortable({move: #{drop_index-drag_index}, handle: '.grip'});"
|
||||
end
|
||||
|
||||
Then /^context "([^"]*)" should be above context "([^"]*)"$/ do |context_high, context_low|
|
||||
|
|
|
@ -891,7 +891,7 @@ var ContextListPage = {
|
|||
/* make the two state lists of context sortable */
|
||||
$(['active', 'hidden']).each(function() {
|
||||
$("#list-contexts-"+this).sortable({
|
||||
handle: '.handle',
|
||||
handle: '.grip',
|
||||
update: update_order
|
||||
})
|
||||
});
|
||||
|
|
|
@ -430,12 +430,12 @@ input.item-checkbox {
|
|||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.rec_description, .description, .project_description {
|
||||
.rec_description, .description, .project_description, .context_description {
|
||||
margin-left: 80px;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.project_description {
|
||||
.project_description, .context_description {
|
||||
margin-left: 50px;
|
||||
}
|
||||
|
||||
|
@ -861,6 +861,7 @@ form {
|
|||
padding: 10px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.inline-form {
|
||||
border: none;
|
||||
padding: 3px;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue