Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go visit calendar jump to #189

Merged
merged 2 commits into from
Nov 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/controllers/service_calendars_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ def rename_visit
def set_day
day = params[:day]
position = params[:position].to_i
arm = Arm.find params[:arm_id]
portal = params[:portal]
@arm = Arm.find params[:arm_id]
@portal = params[:portal]

if !arm.update_visit_group_day(day, position, portal)
if !@arm.update_visit_group_day(day, position, @portal)
respond_to do |format|
format.js { render :status => 418, :json => clean_messages(arm.errors.messages) }
format.js { render :status => 418, :json => clean_messages(@arm.errors.messages) }
end
end
end
Expand Down
10 changes: 8 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def generate_visit_header_row arm, service_request, page, sub_service_request, p
raw(returning_html)
end

def visits_select_options arm, pages
def visits_select_options(arm, pages)
num_pages = (arm.visit_count / 5.0).ceil
arr = []
selected = pages[arm.id].to_i == 0 ? 1 : pages[arm.id].to_i
Expand All @@ -161,7 +161,13 @@ def visits_select_options arm, pages
arr << option

(beginning_visit..ending_visit).each do |y|
arr << ["--#{arm.visit_groups[y - 1].name}".html_safe, :parent_page => page]
visit_group = arm.visit_groups[y - 1]

if visit_group.day.present?
arr << ["--#{visit_group.name}/Day #{visit_group.day}".html_safe, parent_page: page]
else
arr << ["--#{visit_group.name}".html_safe, parent_page: page]
end
end
end

Expand Down
1 change: 1 addition & 0 deletions app/views/service_calendars/_visit_selector.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= generate_visit_navigation(arm, service_request, tab, portal)
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
%th.your_cost_header{:rowspan => 2}= t(:calendar_page)[:headers][:your_cost]
%th.number_of_subjects_header{:rowspan => 2}= t(:calendar_page)[:headers][:subjects]
%th{:colspan => 5, :height => 40, :width => 375}
= generate_visit_navigation arm, @service_request, @pages, tab, portal
= render partial: 'visit_selector', locals: { arm: arm, service_request: @service_request, pages: @pages, tab: tab, portal: portal }
%th{:rowspan => 2}= t(:calendar_page)[:headers][:total_per_patient]
%th.total_per_study{:rowspan => 2}= t(:calendar_page)[:headers][:total_per_study]

Expand All @@ -41,7 +41,7 @@
%th.qty_type_header{:rowspan => 2}= t(:calendar_page)[:headers][:clinical_qty]
%th.number_of_subjects_header{:rowspan => 2}= t(:calendar_page)[:headers][:subjects]
%th{:colspan => 5, :height => 40, :width => 375}
= generate_visit_navigation arm, @service_request, @pages, @tab, @portal
= render partial: 'visit_selector', locals: { arm: arm, service_request: @service_request, pages: @pages, tab: tab, portal: portal }
%th{:rowspan => 2}= t(:calendar_page)[:headers][:total_per_patient]
%th.total_per_study{:rowspan => 2}= t(:calendar_page)[:headers][:total_per_study]

Expand All @@ -59,7 +59,7 @@
%th.number_of_subjects_header{:rowspan => 2}= t(:calendar_page)[:headers][:subjects]
%th
%th{:colspan => 5, :height => 40, :width => 375}
= generate_visit_navigation arm, service_request, @pages, @tab, @portal
= render partial: 'visit_selector', locals: { arm: arm, service_request: @service_request, pages: @pages, tab: tab, portal: portal }
%th{:colspan => 2}= image_tag 'spinner.gif', :class => 'service_calendar_spinner'

%tr.table_header
Expand All @@ -71,4 +71,4 @@
%th &nbsp;
- else
%th= t(:calendar_page)[:headers][:total_per_patient]
%th.total_per_study= t(:calendar_page)[:headers][:total_per_study]
%th.total_per_study= t(:calendar_page)[:headers][:total_per_study]
3 changes: 3 additions & 0 deletions app/views/service_calendars/set_day.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

$('.jump_to_visit').
empty().
html("<%= escape_javascript(render(partial: 'visit_selector', locals: { arm: @arm, service_request: @service_request, tab: 'calendar', portal: @portal })) %>");