-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds general settings, implements updating the company name
- Loading branch information
Showing
7 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,21 @@ | ||
class SettingsController < ApplicationController | ||
|
||
before_action :require_company_owner_or_admin! | ||
def show | ||
end | ||
|
||
def update | ||
if current_company.update(update_params) | ||
flash[:success] = "Company updated successfully" | ||
redirect_to settings_path | ||
else | ||
render :show | ||
end | ||
end | ||
|
||
private | ||
|
||
def update_params | ||
params.require(:company).permit(:name) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
|
||
// Connects to data-controller="settings-tabs" | ||
export default class extends Controller { | ||
|
||
close() { | ||
this.element.remove() | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,26 @@ | ||
<%= render(Settings::TabsComponent.new) %> | ||
<%= render(Settings::TabsComponent.new) %> | ||
|
||
<div class="bg-white p-4 mt-4"> | ||
<%= form_for current_company, url: settings_path do |f| %> | ||
<div class="space-y-12"> | ||
<div class="border-b border-gray-900/10 pb-12"> | ||
<h2 class="text-base font-semibold leading-7 text-gray-900">General settings</h2> | ||
<p class="mt-1 text-sm leading-6 text-gray-600">This is an area that might make sense for a company's default settings (projects bill monthly, etc.)</p> | ||
|
||
<div class="mt-10 grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> | ||
<div class="sm:col-span-4"> | ||
<%= f.label :name, "Company Name", class: "block text-sm font-medium leading-6 text-gray-900" %> | ||
|
||
<div class="mt-2"> | ||
<%= f.text_field :name, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="mt-6 flex items-center justify-end gap-x-6"> | ||
<%= f.submit "Save", class: "rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" %> | ||
</div> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters