Skip to content

Commit

Permalink
Add upsale route for sharing
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
HDinger committed Oct 23, 2024
1 parent afc5d35 commit 34c0b72
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
header.with_action_button(tag: :a,
mobile_icon: :"op-baseline",
mobile_label: I18n.t("js.baseline.toggle_title"),
href: @project.present? ? baseline_dialog_project_work_packages_path(@project) : baseline_dialog_project_work_packages_path(),
href: @project.present? ? baseline_dialog_project_work_packages_path(@project) : baseline_dialog_work_packages_path(),
aria: { label: I18n.t("js.baseline.toggle_title") },
title: I18n.t("js.baseline.toggle_title"),
data: { controller: "async-dialog" },
Expand Down
11 changes: 11 additions & 0 deletions app/controllers/work_packages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class WorkPackagesController < ApplicationController
before_action :load_work_packages, only: :index, if: -> { request.format.atom? }
before_action :load_and_validate_query_for_export, only: :export_dialog

no_authorization_required! :share_upsale

def index
respond_to do |format|
format.html do
Expand Down Expand Up @@ -112,6 +114,15 @@ def new
end
end

def share_upsale
respond_to do |format|
format.html do
render :share_upsale,
locals: { query: @query, project: @project, menu_name: project_or_global_menu }
end
end
end

def export_dialog
respond_with_dialog WorkPackages::Exports::ModalDialogComponent.new(query: @query, project: @project, title: params[:title])
end
Expand Down
5 changes: 5 additions & 0 deletions app/views/work_packages/share_upsale.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% html_title(t('activerecord.attributes.project.work_packages')) -%>

<% content_for :content_body do %>
<%= angular_component_tag "opce-share-upsale" %>
<% end %>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@
get "/" => "work_packages#index", on: :collection, as: "index"
# We do not want to match the work package export routes
#get "(/*state)" => "work_packages#show", on: :member, as: "", constraints: { id: /\d+/, state: /(?!(shares|split_view|split_create|copy)).+/ }
get "/share_upsale" => "work_packages#index", on: :collection, as: "share_upsale"
get "/share_upsale" => "work_packages#share_upsale", on: :collection, as: "share_upsale"
get "/edit" => "work_packages#show", on: :member, as: "edit"
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,11 @@ import {
ChangeDetectionStrategy,
Component,
ElementRef,
EventEmitter,
HostBinding,
Input,
OnInit,
Output,
} from '@angular/core';

import { I18nService } from 'core-app/core/i18n/i18n.service';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { HalResourceService } from 'core-app/features/hal/services/hal-resource.service';
import SpotDropAlignmentOption from 'core-app/spot/drop-alignment-options';
import { WeekdayService } from 'core-app/core/days/weekday.service';
import { DayResourceService } from 'core-app/core/state/days/day.service';
import { IDay } from 'core-app/core/state/days/day.model';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
import { ConfigurationService } from 'core-app/core/config/configuration.service';
import { Observable } from 'rxjs';
import {
DEFAULT_TIMESTAMP,
WorkPackageViewBaselineService,
} from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service';
import { validDate } from 'core-app/shared/components/datepicker/helpers/date-modal.helpers';
import {
baselineFilterFromValue,
getPartsFromTimestamp,
offsetToUtcString,
} from 'core-app/features/work-packages/components/wp-baseline/baseline-helpers';
import * as moment from 'moment-timezone';
import { BannersService } from 'core-app/core/enterprise/banners.service';
import { enterpriseDocsUrl } from 'core-app/core/setup/globals/constants.const';
import { DayElement } from 'flatpickr/dist/types/instance';
import { populateInputsFromDataset } from 'core-app/shared/components/dataset-inputs';
import { WorkPackageIsolatedQuerySpaceDirective } from 'core-app/features/work-packages/directives/query-space/wp-isolated-query-space.directive';


@Component({
hostDirectives: [WorkPackageIsolatedQuerySpaceDirective],
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [
// menuItemClass,
// WorkPackageSplitViewComponent,
// ),
{
url: '/share_upsale',
name: 'work-packages.share_upsale',
component: ShareUpsaleComponent,
},
// {
// url: '/share_upsale',
// name: 'work-packages.share_upsale',
// component: ShareUpsaleComponent,
// },
// Avoid lazy-loading the routes for now
// {
// name: 'work-packages.calendar.**',
Expand Down

0 comments on commit 34c0b72

Please sign in to comment.