diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-02-29 13:18:29 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-02-29 13:18:29 +0000 |
commit | 2ea8f71bb42e63caf58ab285d0c4e483c2c4de19 (patch) | |
tree | 3ecbb3e93baa7b46864348bab306003e831f194f /app/controllers | |
parent | a297e4404855bc79c53d5c1ca4df023a238c1798 (diff) | |
parent | 9a2869ab4674b8a6b94ec206660e083a00d4db37 (diff) | |
download | gitlab-ce-2ea8f71bb42e63caf58ab285d0c4e483c2c4de19.tar.gz |
Merge branch '11489-branded-appearance-to-ce' into 'master'
Branded appearance to CE
Closes #11489
The difference with the EE version is only that there is no distinction between light and dark logos, though this wasn't used anyway. If this is fine, I'll create a MR on EE too.
TODO:
- [x] Copy docs
- [x] Make new screenshots
- [ ] Remove Custom Welcome message feature?
@rymai: I was unsure what labels to add to ping you, so I just ping you like this :wink:
/cc @DouweM
See merge request !2927
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/appearances_controller.rb | 57 | ||||
-rw-r--r-- | app/controllers/uploads_controller.rb | 5 |
2 files changed, 60 insertions, 2 deletions
diff --git a/app/controllers/admin/appearances_controller.rb b/app/controllers/admin/appearances_controller.rb new file mode 100644 index 00000000000..26cf74e4849 --- /dev/null +++ b/app/controllers/admin/appearances_controller.rb @@ -0,0 +1,57 @@ +class Admin::AppearancesController < Admin::ApplicationController + before_action :set_appearance, except: :create + + def show + end + + def preview + end + + def create + @appearance = Appearance.new(appearance_params) + + if @appearance.save + redirect_to admin_appearances_path, notice: 'Appearance was successfully created.' + else + render action: 'show' + end + end + + def update + if @appearance.update(appearance_params) + redirect_to admin_appearances_path, notice: 'Appearance was successfully updated.' + else + render action: 'show' + end + end + + def logo + @appearance.remove_logo! + + @appearance.save + + redirect_to admin_appearances_path, notice: 'Logo was succesfully removed.' + end + + def header_logos + @appearance.remove_header_logo! + @appearance.save + + redirect_to admin_appearances_path, notice: 'Header logo was succesfully removed.' + end + + private + + # Use callbacks to share common setup or constraints between actions. + def set_appearance + @appearance = Appearance.last || Appearance.new + end + + # Only allow a trusted parameter "white list" through. + def appearance_params + params.require(:appearance).permit( + :title, :description, :logo, :logo_cache, :header_logo, :header_logo_cache, + :updated_by + ) + end +end diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index 868b05929d7..509f4f412ca 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -55,14 +55,15 @@ class UploadsController < ApplicationController "user" => User, "project" => Project, "note" => Note, - "group" => Group + "group" => Group, + "appearance" => Appearance } upload_models[params[:model]] end def upload_mount - upload_mounts = %w(avatar attachment file) + upload_mounts = %w(avatar attachment file logo header_logo) if upload_mounts.include?(params[:mounted_as]) params[:mounted_as] |