-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove ember * Switch Rails to non api mode * Add index and show for people * Migrate to haml instead of erb * Remove frontend pipeline stuff * update crud & list controller show all skills via SSR * implement show and list for people * add bootstrap * remove index.html and add favicon * add puzzleshell * add images folder and add it to assetpipeline * split bootstrap.scss and global scss in diffrent files * update node version * render template only if existing * fix picture_controller.rb test * split api and ssr * xdescribe irrelevant test * Make rubocop happy --------- Co-authored-by: Robin Steiner <[email protected]> Co-authored-by: Yanick Minder <[email protected]>
- Loading branch information
1 parent
097e644
commit 5494691
Showing
697 changed files
with
542 additions
and
71,428 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,15 +25,7 @@ jobs: | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
|
||
- name: Install Ember-Cli with NPM | ||
run: npm install -g [email protected] | ||
working-directory: frontend | ||
|
||
- name: Install dependencies Yarn | ||
run: yarn install --frozen-lockfile | ||
working-directory: frontend | ||
node-version: '18' | ||
|
||
- name: Setup test database | ||
env: | ||
|
@@ -56,6 +48,3 @@ jobs: | |
|
||
- name: Run RuboCop | ||
run: bundle exec rubocop --parallel | ||
|
||
- name: Run Frontend Tests | ||
run: bundle exec rake spec:frontend |
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
web: env RUBY_DEBUG_OPEN=true bin/rails server | ||
js: yarn build --watch | ||
css: yarn watch:css |
File renamed without changes.
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,2 @@ | ||
//= link_tree ../builds | ||
//= link_tree ../images |
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,2 @@ | ||
@import 'bootstrap/scss/bootstrap'; | ||
@import 'bootstrap-icons/font/bootstrap-icons'; |
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 @@ | ||
@import "bootstrap"; |
2 changes: 1 addition & 1 deletion
2
app/controllers/activities_controller.rb → app/controllers/api/activities_controller.rb
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,6 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
class ActivitiesController < PersonRelationsController | ||
class Api::ActivitiesController < Api::PersonRelationsController | ||
self.permitted_attrs = %i[description role technology year_from | ||
month_from year_to month_to person_id] | ||
end |
2 changes: 1 addition & 1 deletion
2
...trollers/advanced_trainings_controller.rb → ...lers/api/advanced_trainings_controller.rb
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,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class AdvancedTrainingsController < PersonRelationsController | ||
class Api::AdvancedTrainingsController < Api::PersonRelationsController | ||
self.permitted_attrs = %i[description year_to month_to year_from month_from person_id] | ||
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,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::ApplicationController < ActionController::API | ||
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,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::BranchAdressesController < Api::CrudController | ||
end |
2 changes: 1 addition & 1 deletion
2
app/controllers/categories_controller.rb → app/controllers/api/categories_controller.rb
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
2 changes: 1 addition & 1 deletion
2
app/controllers/companies_controller.rb → app/controllers/api/companies_controller.rb
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 |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# frozen_string_literal: true | ||
|
||
# A generic controller to display, create, update and destroy entries of a certain model class. | ||
class Api::CrudController < Api::ListController | ||
class_attribute :permitted_attrs, :nested_models, :permitted_relationships | ||
|
||
# GET /users/1 | ||
def show(options = {}) | ||
render_entry({ include: '*' }.merge(options[:render_options] || {})) | ||
end | ||
|
||
# POST /users | ||
def create(options = {}) | ||
build_entry | ||
if entry.save | ||
render_entry({ status: :created, | ||
location: entry_url } | ||
.merge(options[:render_options] || {})) | ||
else | ||
render_errors | ||
end | ||
end | ||
|
||
# PATCH/PUT /users/1 | ||
def update(options = {}) | ||
entry.attributes = model_params | ||
if entry.save | ||
render_entry(options[:render_options]) | ||
else | ||
render_errors | ||
end | ||
end | ||
|
||
# DELETE /users/1 | ||
def destroy(_options = {}) | ||
if entry.destroy | ||
head :no_content | ||
else | ||
render_errors | ||
end | ||
end | ||
|
||
private | ||
|
||
def entry | ||
instance_variable_get(:"@#{ivar_name}") || | ||
instance_variable_set(:"@#{ivar_name}", fetch_entry) | ||
end | ||
|
||
def fetch_entry | ||
model_scope.find(params.fetch(:id)) | ||
end | ||
|
||
def build_entry | ||
instance_variable_set(:"@#{ivar_name}", model_scope.new(model_params)) | ||
end | ||
|
||
def render_entry(options = {}) | ||
render({ json: entry, | ||
serializer: model_serializer, | ||
root: model_root_key } | ||
.merge(render_options) | ||
.merge(options || {})) | ||
end | ||
|
||
def render_errors | ||
render json: entry, status: :unprocessable_entity, | ||
adapter: :json_api, serializer: ActiveModel::Serializer::ErrorSerializer | ||
end | ||
|
||
def entry_url | ||
send("#{self.class.name.underscore | ||
.gsub(/_controller$/, '') | ||
.gsub(/\//, '_').singularize}_url", entry) | ||
end | ||
|
||
# Only allow a trusted parameter "white list" through. | ||
def model_params | ||
attrs = params[:data][:attributes].permit(permitted_attrs) | ||
attrs = map_relationships(attrs) | ||
AttributeDeserializer.new(attrs, nested_models: nested_models).run | ||
end | ||
|
||
def map_relationships(attrs) | ||
relationships = params[:data][:relationships] | ||
|
||
return attrs if relationships.blank? | ||
|
||
relationships.each do |model_name, data| | ||
attrs[relationship_param_name(model_name)] = relationship_ids(data, model_name) | ||
end | ||
attrs | ||
end | ||
|
||
def relationship_param_name(model_name) | ||
permitted_param?("#{model_name}_id") ? "#{model_name}_id" : "#{model_name.singularize}_ids" | ||
end | ||
|
||
def relationship_ids(model_data, name) | ||
return unless model_data[:data] | ||
return model_data[:data][:id] unless model_data[:data].is_a?(Array) | ||
|
||
if permitted_relationship?(name) | ||
model_data[:data].collect do |e| | ||
e[:id] | ||
end | ||
end | ||
end | ||
|
||
def permitted_param?(attribute_name) | ||
permitted_attrs.map(&:to_s).include?(attribute_name) | ||
end | ||
|
||
def permitted_relationship?(attribute_name) | ||
permitted_relationships.map(&:to_s).include?(attribute_name) | ||
end | ||
|
||
def ivar_name | ||
model_class.model_name.param_key | ||
end | ||
|
||
def get_asset_path(filename) | ||
manifest_file = Rails.application.assets_manifest.assets[filename] | ||
if manifest_file | ||
File.join(Rails.application.assets_manifest.directory, manifest_file) | ||
else | ||
Rails.application.assets&.[](filename)&.filename | ||
end | ||
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,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::DepartmentsController < Api::CrudController | ||
end |
Oops, something went wrong.