Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions app/assets/javascripts/application.coffee.erb
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,17 @@ $ ->
$(document).on 'turbolinks:load', () ->
$('#textsizer a').textresizer({ target: '#main-content' })

$(document).on 'click', '.check-all', () ->
checked = $(@).is(':checked')
$('.' + $(@).data('type')).each () ->
$(@).prop('checked', checked)
$(document).on 'click', 'body ul.nav a:not(.dropdown-toggle)', () ->
if $(this)[0].dataset and $(this)[0].dataset['bsToggle'] and $('.static-overlay').is(':visible')
$('.static-overlay').hide()
$('body ul.nav a').removeClass 'active'
$(this).addClass 'active'
$(this).parents('.dropdown').find('.dropdown-toggle').addClass 'active'

$(document).on 'click', '.check-all', () ->
checked = $(@).is(':checked')
$('.' + $(@).data('type')).each () ->
$(@).prop('checked', checked)

$(document).on 'click', '.sidebar-toggler', () ->
width = $('.sidebar').width()
Expand Down
16 changes: 15 additions & 1 deletion app/assets/stylesheets/application.sass
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ header
margin: 5px 0

#logo2
height: 80px
float: right
margin: 5px 0

Expand Down Expand Up @@ -354,8 +355,13 @@ header
.hidden-page
display: none

.recent-request
background-color: #d9edf7
border: 1px solid #bce8f1
margin-bottom: 1.5em

.statistic-box
width: 90%
width: 100%
text-align: center

.statistic-box-figure
Expand Down Expand Up @@ -468,5 +474,13 @@ body.mobile
.statistic-overlay
display: none

.nav.nav-pills
margin-top: -25px

.nav-pills .nav-link
background-color: #669cca
color: #fff
margin-right: 0.5em

.dropdown-menu
z-index: 1700
4 changes: 2 additions & 2 deletions app/controllers/requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def index
@requests.sort_by!(&:requested_datetime).reverse!
@pages = (@requests.count / @per_page.to_f).ceil
path = Rails.root.join(Settings::Client.resources_overview_path)
FileUtils.rm_rf path
FileUtils.mkdir_p path
FileUtils.rm_rf Dir.glob(path.join('*.html'))
all_requests = @requests
all_requests.each_slice(@per_page) do |requests|
@requests = requests
File.write path.join("#{@page}.html"), render_to_string(layout: !Settings::Client.resources_overview_remote)
File.write path.join("#{@page}.html"), render_to_string(layout: false)
@page += 1
end
return head :ok
Expand Down
5 changes: 2 additions & 3 deletions app/controllers/starts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
class StartsController < ApplicationController
def show
@request_id = params[:request]
return redirect_to "#{Settings::Url.ks_server_url}#{map_path request: @request_id, mobile: true}" if login_required?
return redirect_to "#{Settings::Url.ks_server_url}#{map_path}" if Settings::Client.skip_extra_homepage && !@mobile

return redirect_to map_url(request: @request_id, mobile: true) if login_required?
return redirect_to map_url unless @mobile
recent_requests
end

Expand Down
9 changes: 4 additions & 5 deletions app/controllers/statics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def privacy
end

def promotion
return head(:not_found) unless Settings::StaticPage.promotion
@file_name = 'werbung'
render :api
end
Expand All @@ -35,21 +36,19 @@ def requests
end

def contact
return head(:not_found) unless Settings::StaticPage.contact
@file_name = 'contact'
render :api
end

def news
return head(:not_found) unless Settings::StaticPage.news
@file_name = 'news'
render :api
end

def finance
@file_name = 'finance'
render :api
end

def participation
return head(:not_found) unless Settings::StaticPage.participation
@file_name = 'participation'
render :api
end
Expand Down
7 changes: 3 additions & 4 deletions app/views/application/_menue_bottom.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<%= link_to t(:mobile), [:start, { mobile: true }], data: { turbolinks: false } %> |
<%= link_to t(:api), api_static_path %> |
<%= link_to t(:mobile), [:start, mobile: true], data: { turbolinks: false } %> |
<%= link_to t(:api), api_static_path, remote: true %> |
<% if Settings::Url.ks_demo_url.present? -%>
<%= link_to t(:demo), Settings::Url.ks_demo_url, data: { turbolinks: false }, target: '_blank', rel: 'noopener' %> |
<% end -%>
<%= link_to t(:github), Settings::Url.ks_github_url, data: { turbolinks: false }, target: '_blank', rel: 'noopener' %> |
<%= link_to t(:promotion), %i[promotion static] %>
<%= link_to t(:github), Settings::Url.ks_github_url, data: { turbolinks: false }, target: "_blank" %>
40 changes: 38 additions & 2 deletions app/views/application/_menue_top_left.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@
<ul class="nav nav-pills">
<li class="nav-item">
<a href="#request" id="requests" class="nav-link active header-tab" data-bs-toggle="tab" data-url="<%= requests_path %>"><%= t('.request') %></a>
<a href="#request" id="requests" class="nav-link active header-tab" data-bs-toggle="tab" data-url="<%= requests_path %>"><%= t(:request) %></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<%= t(:info) %>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li>
<a href="#watch" id="areas" class="dropdown-item" data-bs-toggle="tab" data-url="<%= areas_path %>"><%= t(:watch) %></a>
</li>
<li>
<%= link_to t(:recent_requests), recent_requests_start_path, class: 'dropdown-item', remote: true %>
</li>
<li>
<%= link_to t(:list), requests_static_path, class: 'dropdown-item', remote: true %>
</li>
<% if Settings::StaticPage.news %>
<li>
<%= link_to t(:news), news_static_path, class: 'dropdown-item', remote: true %>
</li>
<% end -%>
<% if Settings::StaticPage.promotion %>
<li>
<%= link_to t(:promotion), promotion_static_path, class: 'dropdown-item', remote: true %>
</li>
<% end -%>
<% if Settings::StaticPage.participation %>
<li>
<%= link_to t(:participation), participation_static_path, class: 'dropdown-item', remote: true %>
</li>
<% end -%>
</ul>
</li>
<li class="nav-item">
<a href="#watch" id="areas" class="nav-link header-tab" data-bs-toggle="tab" data-url="<%= areas_path %>"><%= t('.watch') %></a>
<%= link_to t(:statistic), statistics_path, class: 'nav-link', remote: true %>
</li>
<% if Settings::StaticPage.contact %>
<li class="nav-item">
<%= link_to t(:contact), contact_static_path, class: 'nav-link', remote: true %>
</li>
<% end -%>
</ul>
10 changes: 4 additions & 6 deletions app/views/application/_menue_top_right.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<%= link_to t(:list), %i[requests static] %> |
<%= link_to t(:statistic), [:statistics], data: { turbolinks: false } %> |
<%= link_to t(:help), help_static_path %> |
<%= link_to t(:help), help_static_path, remote: true %> |
<% if Settings::Url.respond_to?(:external_privacy_url) -%>
<%= link_to t(:privacy), Settings::Url.external_privacy_url, target: '_blank', rel: 'noopener' %> |
<% else -%>
<%= link_to t(:privacy), privacy_static_path %> |
<%= link_to t(:privacy), privacy_static_path, remote: true %> |
<% end -%>
<%= link_to t(:imprint), imprint_static_path %> |
<%= link_to t(:usage), usage_static_path %>
<%= link_to t(:imprint), imprint_static_path, remote: true %> |
<%= link_to t(:usage), usage_static_path, remote: true %>
15 changes: 5 additions & 10 deletions app/views/requests/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
<ul class="pagination mt-3">
<% if @page != 1 -%>
<li class="page-item">
<%= link_to content_tag(:span, '«'), requests_page_static_path(page: @page - 1), class: 'page-link',
remote: Settings::Client.resources_overview_remote %>
<%= link_to content_tag(:span, '«'), requests_page_static_path(page: @page - 1), class: 'page-link', remote: true %>
</li>
<% end -%>

<% if start > 1 -%>
<li class="page-item">
<%= link_to 1, requests_page_static_path(page: 1), class: 'page-link',
remote: Settings::Client.resources_overview_remote %>
<%= link_to 1, requests_page_static_path(page: 1), class: 'page-link', remote: true %>
</li>
<% end %>

Expand All @@ -27,8 +25,7 @@
<% (ending - start).to_i.times do |i| -%>
<% ix = (start + i) %>
<li class="page-item <%= 'active' if ix == @page %>">
<%= link_to ix, requests_page_static_path(page: ix), class: 'page-link',
remote: Settings::Client.resources_overview_remote %>
<%= link_to ix, requests_page_static_path(page: ix), class: 'page-link', remote: true %>
</li>
<% end -%>

Expand All @@ -40,15 +37,13 @@

<% if ending <= @pages -%>
<li class="page-item">
<%= link_to @pages, requests_page_static_path(page: @pages), class: 'page-link',
remote: Settings::Client.resources_overview_remote %>
<%= link_to @pages, requests_page_static_path(page: @pages), class: 'page-link', remote: true %>
</li>
<% end %>

<% if @page != @pages -%>
<li class="page-item">
<%= link_to content_tag(:span, '»'), requests_page_static_path(page: @page + 1), class: 'page-link',
remote: Settings::Client.resources_overview_remote %>
<%= link_to content_tag(:span, '»'), requests_page_static_path(page: @page + 1), class: 'page-link', remote: true %>
</li>
<% end -%>
</ul>
Expand Down
31 changes: 0 additions & 31 deletions app/views/starts/_desktop.html.erb

This file was deleted.

11 changes: 6 additions & 5 deletions app/views/starts/_mobile.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
<%= t('.hints') %>
</div>
</div>
<div class="row mb-5">
<div class="col-12 text-center">
<%= link_to t('.button'), map_path(mobile: @mobile), class: 'btn btn-lg btn-primary', data: { turbolinks: false } %>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="statistic">
<%= render(partial: 'shared/statistic', locals: { css_col: 'col-12' }) %>
</div>
</div>
</div>
<div class="row">
<div class="col-12 text-center">
<%= link_to t('.button'), map_path(mobile: @mobile), class: 'btn btn-lg btn-primary', data: { turbolinks: false } %>
</div>
</div>

38 changes: 19 additions & 19 deletions config/brakeman.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,44 @@
{
"warning_type": "File Access",
"warning_code": 16,
"fingerprint": "32ea586fcef640f60945ff20c084a412ed5fe5a7a03ca65a80bb6980c77284b5",
"fingerprint": "a6c1f01a977526e7686d7946cebad7c9bc67d975b1247133b0ddade447d078f0",
"check_name": "FileAccess",
"message": "Model attribute used in file name",
"file": "app/controllers/requests_controller.rb",
"line": 43,
"file": "config/initializers/i18n.rb",
"line": 4,
"link": "https://brakemanscanner.org/docs/warning_types/file_access/",
"code": "FileUtils.rm_rf(Rails.root.join(Settings::Client.resources_overview_path))",
"code": "Dir[Rails.root.join(Settings::Client.resources_path, \"locales/*.yml\")]",
"render_path": null,
"location": {
"type": "method",
"class": "RequestsController",
"method": "index"
},
"user_input": "Settings::Client.resources_overview_path",
"location": null,
"user_input": "Settings::Client.resources_path",
"confidence": "Weak",
"cwe_id": [
22
],
"note": "resources_overview_path is read from config/settings.yml, no user defined content possible."
"note": "resources_path is read from config/settings.yml, no user defined content possible."
},
{
"warning_type": "File Access",
"warning_code": 16,
"fingerprint": "a6c1f01a977526e7686d7946cebad7c9bc67d975b1247133b0ddade447d078f0",
"fingerprint": "e18e6b5206f491ab6e54022a8c36e2cf4a35990e913ef43b10e5fdbdbf56c432",
"check_name": "FileAccess",
"message": "Model attribute used in file name",
"file": "config/initializers/i18n.rb",
"line": 4,
"file": "app/controllers/requests_controller.rb",
"line": 44,
"link": "https://brakemanscanner.org/docs/warning_types/file_access/",
"code": "Dir[Rails.root.join(Settings::Client.resources_path, \"locales/*.yml\")]",
"code": "Dir.glob(Rails.root.join(Settings::Client.resources_overview_path).join(\"*.html\"))",
"render_path": null,
"location": null,
"user_input": "Settings::Client.resources_path",
"location": {
"type": "method",
"class": "RequestsController",
"method": "index"
},
"user_input": "Settings::Client.resources_overview_path",
"confidence": "Weak",
"cwe_id": [
22
],
"note": "resources_path is read from config/settings.yml, no user defined content possible."
"note": "resources_overview_path is read from config/settings.yml, no user defined content possible."
},
{
"warning_type": "File Access",
Expand All @@ -49,7 +49,7 @@
"check_name": "FileAccess",
"message": "Model attribute used in file name",
"file": "app/controllers/requests_controller.rb",
"line": 44,
"line": 43,
"link": "https://brakemanscanner.org/docs/warning_types/file_access/",
"code": "FileUtils.mkdir_p(Rails.root.join(Settings::Client.resources_overview_path))",
"render_path": null,
Expand Down
Loading