Skip to content

Commit

Permalink
Merge branch 'master' into 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ouranos committed Nov 10, 2017
2 parents 329a5fc + 1f135b1 commit cf3e0d5
Show file tree
Hide file tree
Showing 25 changed files with 123 additions and 45 deletions.
38 changes: 36 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Change Log

## [Unreleased](https://github.com/maestrano/mno-enterprise/tree/4.0)
[Full Changelog](https://github.com/maestrano/mno-enterprise/compare/v3.3.1...4.0)
[Full Changelog](https://github.com/maestrano/mno-enterprise/compare/v3.3.2...4.0)

- Drop support for Ruby < 2.3
- Remove deprecated marketplace_listing
Expand All @@ -18,6 +18,34 @@ The settings have been refactored in v4 to make them more consistent.
* `pricing` and `review` configuration are now nested under `marketplace`
* `devise.registration` is now `devise.registration`

## [v3.3.2](https://github.com/maestrano/mno-enterprise/tree/v3.3.2) (2017-11-09)
[Full Changelog](https://github.com/maestrano/mno-enterprise/compare/v3.3.1...v3.3.2)

**Implemented enhancements:**

- \[MNOE-682\] Add Intercom to Admin Panel [\#513](https://github.com/maestrano/mno-enterprise/pull/513) ([ouranos](https://github.com/ouranos))
- \[PF-183\] Invoice template: add bank statement mention [\#474](https://github.com/maestrano/mno-enterprise/pull/474) ([enizor](https://github.com/enizor))
- Admin build: inject impac-angular dependency [\#412](https://github.com/maestrano/mno-enterprise/pull/412) ([ouranos](https://github.com/ouranos))
- \[MNOE-570\] Storing the time of agreement to TOS [\#407](https://github.com/maestrano/mno-enterprise/pull/407) ([enizor](https://github.com/enizor))
- Invoice PDF - Clarify payment processor [\#403](https://github.com/maestrano/mno-enterprise/pull/403) ([alachaum](https://github.com/alachaum))
- \[PF-164\] Explain roles in invite modal [\#398](https://github.com/maestrano/mno-enterprise/pull/398) ([alexnoox](https://github.com/alexnoox))
- Expose devise config in the frontend [\#384](https://github.com/maestrano/mno-enterprise/pull/384) ([ouranos](https://github.com/ouranos))
- Expose impersonator admin\_role [\#383](https://github.com/maestrano/mno-enterprise/pull/383) ([ouranos](https://github.com/ouranos))
- \[MNOE-447\] Dashboard templates management [\#312](https://github.com/maestrano/mno-enterprise/pull/312) ([ouranos](https://github.com/ouranos))

**Fixed bugs:**

- \[MNOE-699\]\[MNOE-658\] Disallow Staff impersonation [\#545](https://github.com/maestrano/mno-enterprise/pull/545) ([ouranos](https://github.com/ouranos))
- Fix terms of use not being displayed [\#542](https://github.com/maestrano/mno-enterprise/pull/542) ([hedudelgado](https://github.com/hedudelgado))
- \[MNOE-563\]\[MNOE-677\] Add main\_logo\_white\_bg on notifications and fix size [\#536](https://github.com/maestrano/mno-enterprise/pull/536) ([hedudelgado](https://github.com/hedudelgado))
- Authorize staff to manage app instances [\#514](https://github.com/maestrano/mno-enterprise/pull/514) ([fgourichon](https://github.com/fgourichon))
- Fixes - Dashboard templates [\#475](https://github.com/maestrano/mno-enterprise/pull/475) ([cesar-tonnoir](https://github.com/cesar-tonnoir))
- \[MNOE-587\]\[Bug\] Nan average rating [\#451](https://github.com/maestrano/mno-enterprise/pull/451) ([adamaziz15](https://github.com/adamaziz15))
- Fix intermittent 500 errors on dashboard templates controller [\#427](https://github.com/maestrano/mno-enterprise/pull/427) ([cesar-tonnoir](https://github.com/cesar-tonnoir))
- \[MNOE-643\] Add white logo on App loading page [\#419](https://github.com/maestrano/mno-enterprise/pull/419) ([ouranos](https://github.com/ouranos))
- Fix marketplace cache when no apps [\#406](https://github.com/maestrano/mno-enterprise/pull/406) ([ouranos](https://github.com/ouranos))
- \[MNOE-558\] Filter out rejected comments from feedbacks [\#385](https://github.com/maestrano/mno-enterprise/pull/385) ([adamaziz15](https://github.com/adamaziz15))

## [v3.3.1](https://github.com/maestrano/mno-enterprise/tree/v3.3.1) (2017-07-24)
[Full Changelog](https://github.com/maestrano/mno-enterprise/compare/v3.3.0...v3.3.1)

Expand Down Expand Up @@ -51,7 +79,7 @@ See [UPGRADING](UPGRADING.md#migrating-from-v32-to-v33)
**Summary:**

* Onboarding wizard
* Audit Log in the dashboard and admin panel
* Audit Log in the dashboard and admin panel
* Better app generation
* Extracted Admin Panel to a separate project (feature flags & style customisation)
* Improved design of static pages
Expand Down Expand Up @@ -137,6 +165,12 @@ See [UPGRADING](UPGRADING.md#migrating-from-v32-to-v33)
- Fix locale [\#296](https://github.com/maestrano/mno-enterprise/pull/296) ([hedudelgado](https://github.com/hedudelgado))
- Add URL\_CONFIG [\#290](https://github.com/maestrano/mno-enterprise/pull/290) ([fgourichon](https://github.com/fgourichon))

## [v3.2.1](https://github.com/maestrano/mno-enterprise/tree/v3.2.1) (2017-11-09)
[Full Changelog](https://github.com/maestrano/mno-enterprise/compare/v3.2.0...v3.2.1)

**Fixed bugs:**

- \[MNOE-600\] Fix size logo on invoice [\#477](https://github.com/maestrano/mno-enterprise/pull/477) ([hedudelgado](https://github.com/hedudelgado))

## [v3.2.0](https://github.com/maestrano/mno-enterprise/tree/v3.2.0) (2017-06-14)
[Full Changelog](https://github.com/maestrano/mno-enterprise/compare/v3.1.4...v3.2.0)
Expand Down
2 changes: 1 addition & 1 deletion MNOE_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.1
4.0.0-dev
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def terms
ts = MnoEnterprise::App.order(updated_at: :desc).select(:updated_at).first.updated_at
@apps = if ts
Rails.cache.fetch(['pages/terms/app-list', ts]) do
MnoEnterprise::App.fetch_all.reject { |i| i.terms_url.blank? }
# Temp solution as translated fields can not be filtered or sorted
# MnoEnterprise::App.order_by("name.ac").reject{|i| i.terms_url.blank?}
MnoEnterprise::App.fetch_all.reject { |i| i.terms_url.blank? }.sort_by{ |a| a.name.downcase }
end
else
[]
Expand Down
20 changes: 14 additions & 6 deletions api/spec/controllers/mno_enterprise/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,24 @@ module MnoEnterprise
end

describe 'GET #terms' do
let(:app) { build(:app) }
before {
stub_api_v2(:get, '/apps', [app], [], {fields: {apps: 'updated_at'}, page: {number: 1, size: 1}, sort: '-updated_at'})
stub_api_v2(:get, '/apps', [app], [])
}
let(:app1) { build(:app, name: 'b') }
let(:app2) { build(:app, name:'a') }
let(:app3) { build(:app, name: 'c') }

before do
Rails.cache.clear
stub_api_v2(:get, '/apps', [app1], [], {fields: {apps: 'updated_at'}, page: {number: 1, size: 1}, sort: '-updated_at'})
stub_api_v2(:get, '/apps', [app1, app2, app3], [])
end

subject { get :terms }
before { subject }

it { expect(response).to be_success }
end

it 'returns the apps in the correct alphabetical order' do
expect(assigns(:apps).map(&:name)).to eq(%w(a b c))
end
end
end
end
4 changes: 4 additions & 0 deletions core/app/helpers/mno_enterprise/image_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@ def app_image_path(file_name)
def engine_image_path(file_name)
"#{MnoEnterprise::Engine.root}#{IMAGES_LOCATION}#{file_name}"
end

def fit_image
'max-width: 150px; max-height: 150px;'
end
end
end
5 changes: 3 additions & 2 deletions core/app/models/mno_enterprise/dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ def full_name
self.name
end

# Return all the organizations linked to this dashboard and to which
# the user has access
# Return all the organizations linked to this dashboard and to which the user has access
# If the dashboard is a template, return all the current user's organization
def organizations(org_list = nil)
if org_list
return org_list if dashboard_type == 'template'
org_list.to_a.select { |e| self.organization_ids.include?(e.uid) }
else
MnoEnterprise::Organization.where(uid: self.organization_ids).to_a
Expand Down
3 changes: 2 additions & 1 deletion core/app/pdf/mno_enterprise/invoice_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def add_page_header
@pdf.repeat :all do
@pdf.bounding_box([0, @pdf.bounds.top+@format[:header_size]], width: 540, height: @format[:footer_size]) do
@pdf.float do
@pdf.image main_logo_white_bg_path(true), scale: 0.5
@pdf.image main_logo_white_bg_path(true), fit: [135, (@format[:footer_size])]
end
@pdf.move_down 52
@pdf.font_size(20) { @pdf.text "#{title} #{@data[:period_month]}", style: :bold, align: :right }
Expand Down Expand Up @@ -252,6 +252,7 @@ def add_page_body
@pdf.move_down 10
@pdf.indent(5) do
@pdf.font_size(8) do
@pdf.text "<color rgb='999999'> #{t('charging_details.bank_statement', invoice_reference: @data[:invoice_reference])}</color>", inline_format: true
@pdf.text "<color rgb='999999'> #{t('charging_details.currency', currency_name: @data[:invoice_currency_name], currency: @data[:invoice_currency])}</color>", inline_format: true
if @data[:invoice_fully_paid]
@pdf.text "<color rgb='999999'> #{t('charging_details.no_payments')}</color>", inline_format: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p class="header">
<%= image_tag('mno_enterprise/main-logo.png') %>
<%= image_tag(main_logo_white_bg_path, style: fit_image) %>
</p>

<p>Hi <%= @info[:first_name] %></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p class="header">
<%= image_tag('mno_enterprise/main-logo.png') %>
<%= image_tag(main_logo_white_bg_path, style: fit_image) %>
</p>

<p>Hi <%= @info[:first_name] %></p>
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/system_notifications/email-change.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p class="header">
<%= image_tag('mno_enterprise/main-logo.png') %>
<%= image_tag(main_logo_white_bg_path, style: fit_image) %>
</p>

<p>Hi <%= @info[:first_name] %></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p class="header">
<%= image_tag('mno_enterprise/main-logo.png') %>
<%= image_tag(main_logo_white_bg_path, style: fit_image) %>
</p>

<p>Hi there,</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p class="header">
<%= image_tag('mno_enterprise/main-logo.png') %>
<%= image_tag(main_logo_white_bg_path, style: fit_image) %>
</p>

<p>Hi there,</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p class="header">
<%= image_tag('mno_enterprise/main-logo.png') %>
<%= image_tag(main_logo_white_bg_path, style: fit_image) %>
</p>

<p>Hi <%= @info[:first_name] %></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p class="header">
<%= image_tag('mno_enterprise/main-logo.png') %>
<%= image_tag(main_logo_white_bg_path, style: fit_image) %>
</p>

<p>Hi <%= @info[:first_name] %></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p class="header">
<%= image_tag('mno_enterprise/main-logo.png') %>
<%= image_tag(main_logo_white_bg_path, style: fit_image) %>
</p>

<p>Hi there,</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p class="header">
<%= image_tag('mno_enterprise/main-logo.png') %>
<%= image_tag(main_logo_white_bg_path, style: fit_image) %>
</p>

<p>Hi <%= @info[:first_name] %></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p class="header">
<%= image_tag('mno_enterprise/main-logo.png') %>
<%= image_tag(main_logo_white_bg_path, style: fit_image) %>
</p>

<p>Hi <%= @info[:first_name] %></p>
Expand Down
1 change: 1 addition & 0 deletions core/config/locales/pdf/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ en:
account_situation: 'Account Situation'
account_statement: 'Account Statement'
charging_details:
bank_statement: 'This charge will appear as INV %{invoice_reference} on your bank statement.'
currency: 'Charges are all displayed in %{currency_name} (%{currency})'
no_payments: 'No credit card payments required for this invoice'
with_payment: 'Your designated credit card will be charged on %{charge_date} at midnight UTC by Maestrano Pty Ltd as service provider to the %{platform_name} platform.'
Expand Down
1 change: 1 addition & 0 deletions core/config/locales/templates/dashboard/marketplace/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,4 @@ en:
companies_number: "Number of companies using the application"
pricing: "Pricing"
pricing_not_available: "pricing information not available"
no_review: "Rating not yet available"
2 changes: 1 addition & 1 deletion core/lib/mno_enterprise/concerns/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def impac_abilities(user)

# Abilities for admin user
def admin_abilities(user)
if user.admin_role.to_s.casecmp('admin').zero?
if user.admin_role.to_s.casecmp('admin').zero? || user.admin_role.to_s.casecmp('staff').zero?
can :manage_app_instances, MnoEnterprise::Organization
can :manage_sub_tenant, MnoEnterprise::SubTenant
end
Expand Down
2 changes: 1 addition & 1 deletion core/lib/mno_enterprise/mno_enterprise_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MnoEnterprise
VERSION = '4.0.0'
VERSION = '4.0.0-dev'
end
2 changes: 2 additions & 0 deletions core/lib/mno_enterprise/smtp_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
module MnoEnterprise
# Base class (instantiable) for SMTP adapter
class SmtpClient < ActionMailer::Base
helper MnoEnterprise::ImageHelper

# Send SMTP template - terminal mailing part
def deliver(template, from, to, vars={}, opts={})
@info = vars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
sequence(:name) { |n| "Random Dashboard #{n}" }

owner_type 'User'
dashboard_type 'dashboard'

widgets []
widgets_order []
Expand Down
45 changes: 26 additions & 19 deletions core/spec/helpers/image_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,74 @@
module MnoEnterprise
describe ImageHelper do

let(:folder) { "/app/assets/images/mno_enterprise" }
let(:folder) { '/app/assets/images/mno_enterprise' }
let(:root) {"#{Rails.root}#{folder}"}
let(:path_engine_main_logo) { "#{MnoEnterprise::Engine.root}#{folder}/main-logo.png" }
let(:path_main_logo) { "#{root}/main-logo.png" }
let(:path_main_logo_white) { "#{root}/main-logo-whitebg.png" }

describe "#main_logo_white_bg_path" do
describe '#main_logo_white_bg_path' do

context "when no logos exist" do
context 'when no logos exist' do

it "returns the engine main-logo filename" do
expect(helper.main_logo_white_bg_path).to match("mno_enterprise/main-logo.png")
it 'returns the engine main-logo filename' do
expect(helper.main_logo_white_bg_path).to match('mno_enterprise/main-logo.png')
end

it "returns the engine main-logo full path" do
it 'returns the engine main-logo full path' do
expect(helper.main_logo_white_bg_path(true)).to match(path_engine_main_logo)
end
end

context "when main-logo.png exists and main-logo-whitebg.png do not exist" do
context 'when main-logo.png exists and main-logo-whitebg.png do not exist' do
before { allow(File).to receive(:exists?).with(path_main_logo_white).and_return(false) }
before { allow(File).to receive(:exists?).with(path_main_logo).and_return(true) }

it "returns the main-logo filename" do
expect(helper.main_logo_white_bg_path).to match("mno_enterprise/main-logo.png")
it 'returns the main-logo filename' do
expect(helper.main_logo_white_bg_path).to match('mno_enterprise/main-logo.png')
end

it "returns the main-logo full path" do
it 'returns the main-logo full path' do
expect(helper.main_logo_white_bg_path(true)).to match(path_main_logo)
end
end

context "when main-logo-whitebg.png exists" do
context 'when main-logo-whitebg.png exists' do
before { allow(File).to receive(:exists?).with(path_main_logo_white).and_return(true) }

it "returns the filename" do
expect(helper.main_logo_white_bg_path).to match("mno_enterprise/main-logo-whitebg.png")
it 'returns the filename' do
expect(helper.main_logo_white_bg_path).to match('mno_enterprise/main-logo-whitebg.png')
end

it "returns the full path" do
it 'returns the full path' do
expect(helper.main_logo_white_bg_path(true)).to match(path_main_logo_white)
end
end
end

describe "#main_logo_path" do
describe '#main_logo_path' do

context "when there are no logos" do
context 'when there are no logos' do

it "returns the engines main-logo " do
it 'returns the engines main-logo' do
expect(helper.main_logo_path).to match(path_engine_main_logo)
end
end

context "when main-logo.png exists" do
context 'when main-logo.png exists' do
before { allow(File).to receive(:exists?).with(path_main_logo).and_return(true) }

it "returns the full path" do
it 'returns the full path' do
expect(helper.main_logo_path).to match(path_main_logo)
end
end
end

describe '#fit_image' do

it 'returns the style' do
expect(helper.fit_image).to match('max-width: 150px; max-height: 150px;')
end
end
end
end
Loading

0 comments on commit cf3e0d5

Please sign in to comment.