Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2019 Navbar changes #308

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'jquery-datatables'
gem 'jbuilder'
gem 'bootstrap-sass'
gem 'simple_form'
Expand Down
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ GEM
jbuilder (2.4.1)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-datatables (1.10.19.1)
jquery-rails (4.1.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
Expand Down Expand Up @@ -358,6 +359,7 @@ DEPENDENCIES
factory_girl_rails
highline
jbuilder
jquery-datatables
jquery-rails
mysql2 (~> 0.4.10)
newrelic_rpm
Expand Down Expand Up @@ -396,4 +398,4 @@ RUBY VERSION
ruby 2.3.0p0

BUNDLED WITH
1.14.5
1.17.3
8 changes: 7 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require datatables
//= require_tree .

$(document).on("ready page:change", function(){
Expand Down Expand Up @@ -57,4 +58,9 @@ function _toggleText(el, opt1, opt2){
var $el = $(el);
if($el.html().trim() == opt1.trim()) $el.html(opt2);
else if($el.html().trim() == opt2.trim()) $el.html(opt1);
}
}

$(document).ready(function () {
$('#tasks').DataTable();
});

65 changes: 65 additions & 0 deletions app/assets/javascripts/datatables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//= require datatables/jquery.dataTables

// optional change '//' --> '//=' to enable

// require datatables/extensions/AutoFill/dataTables.autoFill
// require datatables/extensions/Buttons/dataTables.buttons
// require datatables/extensions/Buttons/buttons.html5
// require datatables/extensions/Buttons/buttons.print
// require datatables/extensions/Buttons/buttons.colVis
// require datatables/extensions/Buttons/buttons.flash
// require datatables/extensions/ColReorder/dataTables.colReorder
// require datatables/extensions/FixedColumns/dataTables.fixedColumns
// require datatables/extensions/FixedHeader/dataTables.fixedHeader
// require datatables/extensions/KeyTable/dataTables.keyTable
// require datatables/extensions/Responsive/dataTables.responsive
// require datatables/extensions/RowGroup/dataTables.rowGroup
// require datatables/extensions/RowReorder/dataTables.rowReorder
// require datatables/extensions/Scroller/dataTables.scroller
// require datatables/extensions/Select/dataTables.select

//= require datatables/dataTables.bootstrap4
// require datatables/extensions/AutoFill/autoFill.bootstrap4
// require datatables/extensions/Buttons/buttons.bootstrap4
// require datatables/extensions/Responsive/responsive.bootstrap4


//Global setting and initializer

$.extend( $.fn.dataTable.defaults, {
responsive: true,
pagingType: 'full',
//dom:
// "<'row'<'col-sm-4 text-left'f><'right-action col-sm-8 text-right'<'buttons'B> <'select-info'> >>" +
// "<'row'<'dttb col-12 px-0'tr>>" +
// "<'row'<'col-sm-12 table-footer'lip>>"
});


$(document).on('preInit.dt', function(e, settings) {
var api, table_id, url;
api = new $.fn.dataTable.Api(settings);
table_id = "#" + api.table().node().id;
url = $(table_id).data('source');
if (url) {
return api.ajax.url(url);
}
});


// init on turbolinks load
$(document).on('turbolinks:load', function() {
if (!$.fn.DataTable.isDataTable("table[id^=dttb-]")) {
$("table[id^=dttb-]").DataTable();
}
});

// turbolinks cache fix
$(document).on('turbolinks:before-cache', function() {
var dataTable = $($.fn.dataTable.tables(true)).DataTable();
if (dataTable !== null) {
dataTable.clear();
dataTable.destroy();
return dataTable = null;
}
});
18 changes: 10 additions & 8 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,43 @@
*
*= require_self
*= require_tree .
*= require datatables
*/

@import "bootstrap";
@import 'bootstrap';
@import 'datatables';

body {
padding-bottom: 30px;
}

.alert-inline{
.alert-inline {
margin: 4px;
padding: 10px;
}

.full-width{
.full-width {
width: 100%;
}

.cart-item{
.cart-item {
padding: 8px 4px 8px 4px;
border-top: 1px solid lightgrey;
width: 100%;
margin: 0;
}

.cart-item div{
.cart-item div {
padding: 0;
}

.cart-warning{
.cart-warning {
background-color: #fcf3dd;
}

.cart-button{
.cart-button {
width: 33%;
white-space: normal;
height: 55px;
border-color: #1d4b97;
}
}
15 changes: 15 additions & 0 deletions app/assets/stylesheets/datatables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@import 'datatables/dataTables.bootstrap4';

// optional remove '//=' to enable

//@import 'datatables/extensions/AutoFill/autoFill.bootstrap4';
//@import 'datatables/extensions/Buttons/buttons.bootstrap4';
//@import 'datatables/extensions/ColReorder/colReorder.bootstrap4';
//@import 'datatables/extensions/FixedColumns/fixedColumns.bootstrap4';
//@import 'datatables/extensions/FixedHeader/fixedHeader.bootstrap4';
//@import 'datatables/extensions/KeyTable/keyTable.bootstrap4';
//@import 'datatables/extensions/Responsive/responsive.bootstrap4';
//@import 'datatables/extensions/RowGroup/rowGroup.bootstrap4';
//@import 'datatables/extensions/RowReorder/rowReorder.bootstrap4';
//@import 'datatables/extensions/Scroller/scroller.bootstrap4';
//@import 'datatables/extensions/Select/select.bootstrap4';
97 changes: 61 additions & 36 deletions app/views/home/_quick_links.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1>Welcome to Binder!</h1>
</div>

<div class="col-xs-10 col-sm-6">
<div>
<% if !user_signed_in? then %>
<% if Rails.env.staging? or Rails.env.production? %>
<p><%= link_to "Login to Begin", main_app.user_omniauth_authorize_path(:shibboleth), :class => "btn btn-success" %></p>
Expand All @@ -11,45 +11,70 @@
<p>Please login to continue.</p>
<% end %>
<% elsif user_signed_in? and !current_user.participant.has_signed_waiver? then %>
<p><%= link_to "Sign Waiver", new_waiver_path, :class => "btn btn-success" %></p>
<br>
<%= link_to "Sign Waiver", new_waiver_path, :class => "btn btn-success" %>
<% end %>

<% if can?(:read, Charge) %>
<p><%= link_to "Charges", charges_path, :class => "btn btn-primary" %></p>
<% end %>
<% if can?(:downtime, OrganizationTimelineEntry) %>
<p><%= link_to "Downtime", downtime_index_path, :class => "btn btn-primary" %></p>
<% end %>
<% if can?(:read, Faq) %>
<p><%= link_to "FAQs", faqs_path, :class => "btn btn-primary" %></p>
<% end %>
<% if can?(:read, Shift) %>
<p><%= link_to "Shifts", shifts_path, :class => "btn btn-primary" %></p>
<% if can?(:read, Faq) && %>
<%= link_to "FAQs", faqs_path, :class => "btn btn-primary" %>
<% end %>

<% if can?(:read, Task) %>
<p><%= link_to "Tasks", tasks_path, :class => "btn btn-primary" %></p>
<% end %>
<% if can?(:structural, OrganizationTimelineEntry) %>
<p><%= link_to "Structural Queue", structural_path, :class => "btn btn-primary" %></p>
<% end %>
<% if can?(:electrical, OrganizationTimelineEntry) %>
<p><%= link_to "Electrical Queue", electrical_path, :class => "btn btn-primary" %></p>
<% end %>
</div> <br>

<div class="row">

<% if user_signed_in? %>
<% if current_user.participant.is_scc? %>

<%# Change to true to enable queues %>
<div class = "col col-sm-3">
<% if true %>
<%= render 'organization_timeline_entries/queue_sidebar' %>
<% end %>
</div>

<%# Change to true to enable downtime %>
<div class = "col col-sm-3">
<% if true %>
<%= render 'organization_timeline_entries/downtime_sidebar' %>
<% end %>
</div>

<div class= "col col-sm-3">
<%= render 'store_cart/store_cart' %>
</div>

<br>

<% if user_signed_in? then %>
<%= form_tag(search_path, class: 'form-inline', role: 'search') do %>
<div class="form-group">
<div class="input-group">
<%= text_field_tag('query', '', :size => 10, :class => 'form-control col-md-6') %>
<span class="input-group-btn">
<%= submit_tag('Search', :class => 'btn btn-default') %>
</span>
</div>
<div class = "col col-sm-3">
<%= render 'tool_cart/tool_cart' %>
</div>

</div>


<div class="row">

<div class= "col col-sm-6">
<% if !@tasks_sidebar.blank? %>
<% cache ['tasks_sidebar', @tasks_sidebar] do %>
<%= render 'tasks/tasks_sidebar' %>
<% end %>
<% end %>
</div>

<div class= "col col-sm-6">
<% if !@current_shifts_sidebar.blank? or !@upcoming_shifts_sidebar.blank? %>
<% cache ['shift_sidebar', 'current', @current_shifts_sidebar, 'upcoming', @upcoming_shifts_sidebar] do%>
<%= render 'shifts/shifts_sidebar' %>
<% end %>
<% end %>
</div>

</div>

<%# Change to true to enable event sidebar %>
<% if true %>
<%= render 'events/events_sidebar' %>
<% end %>


<% end %>
<% end %>
</div>
<% end %>
45 changes: 23 additions & 22 deletions app/views/layouts/_navigation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,17 @@
<ul class="nav navbar-nav navbar-left">
<!-- Normal Navbar LI's -->
<li><%= link_to "Organizations", organizations_path(:type => "building") %></li>
<li><%= link_to "Tools", tools_path %></li>
<li><%= link_to "Store", store_items_path %></li>

<% if current_user.participant.is_booth_chair? %>
<% if can?(:structural, OrganizationTimelineEntry) %>
<li><%= link_to "Structural", structural_path %></li>
<% end %>
<% if can?(:electrical, OrganizationTimelineEntry) %>
<li><%= link_to "Electrical", electrical_path %></li>
<% end %>
<% if can?(:read, Faq) %>
<li><%= link_to "FAQs", faqs_path %></li>
<% end %>

<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Other Links<b class="caret"></b></a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Links<b class="caret"></b></a>
<ul class="dropdown-menu">
<% if can?(:read, Charge) %>
<li><%= link_to "Charges", charges_path %></li>
<% end %>
<% if can?(:read, Faq) %>
<li><%= link_to "FAQs", faqs_path %></li>
<% end %>

<% if can?(:read, Participant) %>
<li><%= link_to "Participants", participants_path %></li>
<% end %>
Expand All @@ -46,6 +36,14 @@
<% if can?(:read, Task) %>
<li><%= link_to "Tasks", tasks_path %></li>
<% end %>
<li><%= link_to "Tools", tools_path %></li>
<li><%= link_to "Store", store_items_path %></li>
<% if can?(:downtime, OrganizationTimelineEntry) %>
<li><%= link_to "Downtime", downtime_index_path %></li>
<% end %>
<% if can?(:read, Event) %>
<li><%= link_to "Event Log", events_path %></li>
<% end %>
<% if !current_user.participant.is_booth_chair? %>
<% if can?(:structural, OrganizationTimelineEntry) %>
<li><%= link_to "Structural Queue", structural_path %></li>
Expand All @@ -57,27 +55,30 @@
</ul>
</li>


<% if current_user.participant.is_scc? %>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">SCC Links<b class="caret"></b></a>
<% if is_admin? %>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Admin Links<b class="caret"></b></a>
<% end %>
<ul class="dropdown-menu">
<% if can?(:downtime, OrganizationTimelineEntry) %>
<li><%= link_to "Downtime", downtime_index_path %></li>
<% end %>
<% if can?(:read, Event) %>
<li><%= link_to "Event Log", events_path %></li>
<% end %>
<% if can?(:create, :reports) %>
<li><%= link_to "Reports", reports_path %></li>
<% end %>
<% if is_admin? %>
<li><%# link_to "Create Carnival", show_uploader_path %></li>
<% end %>
<% if is_admin? %>
<li><%= link_to "Edit Carnival" %></li>
<% end %>
</ul>
</li>
<% end %>

</ul>
<!-- Searchbar -->
<form class="navbar-form navbar-left" role="search" accept-charset="UTF-8" action="/search" method="get" >
<input type="text" class="form-control" placeholder="Search..." id="query" name="query" style="width: 100px;">
<input type="text" class="form-control" placeholder="Search..." id="query" name="query" style="width: 200%;">
</form>
<% end %>

Expand Down
Loading