Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ntd committed Aug 2, 2016
2 parents 1bb925c + 0293457 commit c1f32b8
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 37 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
"source": "http://dev.entidi.com/p/silverstrap/source/tree/master/"
},
"require": {
"silverstripe/framework": "~3.1"
"entidi/silverstrap-module": "~1.0"
},
"extra": {
"screenshots": [
"http://silverstripe.entidi.com/assets/silverstrap.png"
"http://silverstripe.entidi.com/assets/silverstrap.png",
"http://silverstripe.entidi.com/assets/silverstrap-forms.jpeg"
]
},
"suggest": {
Expand Down
3 changes: 3 additions & 0 deletions css/silverstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ ul.nav-stacked ul > li:last-child:visible > a {
background-color: #0088cc;
cursor: pointer;
}
.tooltip-inner {
width: 20em;
}

/**
* Hovering content component, i.e. new content that appears above default
Expand Down
8 changes: 8 additions & 0 deletions js/silverstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ var silverstrap = {
$(document).ready(function () {
var $subject;

// Enable help tooltips for form elements
$subject = $('[data-toggle="tooltip"]');
$subject.tooltip({
placement: function () {
return $(window).width() >= 992 ? 'right' : 'bottom';
}
});

// Enable colorbox support on Fotorama frames
if ($.isFunction($.colorbox) && $.isFunction($.Fotorama)) {
var transition;
Expand Down
29 changes: 14 additions & 15 deletions templates/Includes/Form.ss
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<% if $IncludeFormTag %>
<form class="form-horizontal $extraClass" $getAttributesHTML('class') role="form"><% end_if %><% if $Message %>
<div id="{$FormName}_error" class="alert $MessageType">
<button type="button" class="close" data-dismiss="alert">&times;</button>
$Message
</div><% else %>
<div id="{$FormName}_error" class="alert hide $MessageType"></div><% end_if %>

<fieldset><% if $Legend %>
<legend>$Legend</legend><% end_if %><% loop $Fields %>
$FieldHolder<% end_loop %>
</fieldset><% if $Actions %>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9"><% loop $Actions %>
$Field<% end_loop %>
</div>
</div><% end_if %><% if $IncludeFormTag %>
<div id="{$FormName}_error" class="alert $MessageType">
<button type="button" class="close" data-dismiss="alert">&times;</button>
$Message
</div><% else %>
<div id="{$FormName}_error" class="alert hide $MessageType"></div><% end_if %>
<fieldset><% if $Legend %>
<legend>$Legend</legend><% end_if %><% loop $Fields %>
$FieldHolder<% end_loop %>
</fieldset><% if $Actions %>
<div class="$Silverstrap.group">
<div class="$Silverstrap.no_label $Silverstrap.holder"><% loop $Actions %>
$Field<% end_loop %>
</div>
</div><% end_if %><% if $IncludeFormTag %>
</form><% end_if %>
4 changes: 2 additions & 2 deletions templates/forms/CheckboxField_holder.ss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="form-group $HolderClasses<% if $Message %> has-error<% end_if %>">
<div class="col-sm-offset-3 col-sm-6">
<div class="$Silverstrap.group $HolderClasses<% if $Message %> has-error<% end_if %>">
<div class="$Silverstrap.no_label $Silverstrap.holder">
<div class="checkbox<% if $isReadonly || $isDisabled %> disabled<% end_if %>">
<label>
$Field
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/DropdownField.ss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<select class="form-control $extraClass" $getAttributesHTML('class')<% if $isReadonly %> readonly<% else_if $isDisabled %> disabled<% end_if %>><% loop $Options %>
<select class="$Silverstrap.control $extraClass" $getAttributesHTML('class')<% if $isReadonly %> readonly<% else_if $isDisabled %> disabled<% end_if %>><% loop $Options %>
<option value="$Value.XML"<% if $Selected %> selected<% end_if %><% if $Disabled %> disabled<% end_if %>><% if $Title.exists %>$Title.XML<% else %>&nbsp;<% end_if %></option><% end_loop %>
</select>
8 changes: 4 additions & 4 deletions templates/forms/FieldGroup_holder.ss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="form-group $HolderClasses<% if $Message %> has-error<% end_if %>"><% if $Title %>
<label class="control-label col-sm-3"<% if $ID %> for="$ID"<% end_if %>>$Title</label><% end_if %><% loop $FieldList %>
<div class="$Silverstrap.group $HolderClasses<% if $Message %> has-error<% end_if %>"><% if $Title %>
<label class="$Silverstrap.label"<% if $ID %> for="$ID"<% end_if %>>$Title</label><% end_if %><% loop $FieldList %>
<%-- The following div should pertain to SmallFieldHolder but I cannot pass parameters
to the underlying templates for applying the offset only to the first field --%>
<div class="col-sm-2<% if not $Up.Title && $First %> col-sm-offset-3<% end_if %>">
<div class="$Silverstrap.small_holder<% if not $Up.Title && $First %> $Silverstrap.no_label<% end_if %>">
$SmallFieldHolder
</div><% end_loop %><% if $Message %>
<p class="help-block">$Message</p><% end_if %><% if $RightTitle %>
<label class="control-label col-sm-3"<% if $ID %> for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
<label class="$Silverstrap.right_label"<% if $ID %> for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
</div>
2 changes: 1 addition & 1 deletion templates/forms/FormField.ss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<input class="form-control $extraClass" $getAttributesHTML('class')<% if $isReadonly %> readonly<% else_if $isDisabled %> disabled<% end_if %>>
<input class="$Silverstrap.control $extraClass" $getAttributesHTML('class')<% if $isReadonly %> readonly<% else_if $isDisabled %> disabled<% end_if %><% if $Description && not $isDisabled %> data-toggle="tooltip" title="$Description.ATT"<% end_if %>>
8 changes: 4 additions & 4 deletions templates/forms/FormField_holder.ss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="form-group $HolderClasses<% if $Message %> has-error<% end_if %>"><% if $Title %>
<label class="control-label col-sm-3"<% if $ID %> for="$ID"<% end_if %>>$Title</label><% end_if %>
<div class="<% if not $Title %>col-sm-offset-3 <% end_if %>col-sm-6 $extraClass">
<div class="$Silverstrap.group $HolderClasses<% if $Message %> has-error<% end_if %>"><% if $Title %>
<label class="$Silverstrap.label"<% if $ID %> for="$ID"<% end_if %>>$Title</label><% end_if %>
<div class="<% if not $Title %>$Silverstrap.no_label <% end_if %>$Silverstrap.holder $extraClass">
$Field<% if $Message %>
<p class="help-block">$Message</p><% end_if %>
</div><% if $RightTitle %>
<label class="control-label col-sm-3"<% if $ID %> for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
<label class="$Silverstrap.right_label"<% if $ID %> for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
</div>
4 changes: 2 additions & 2 deletions templates/forms/FormField_holder_small.ss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<% if $Title %><label class="control-label"<% if $ID %> for="$ID"<% end_if %>>$Title</label><% end_if %>
<% if $Title %><label class="$Silverstrap.small_label"<% if $ID %> for="$ID"<% end_if %>>$Title</label><% end_if %>
$Field<% if $RightTitle %>
<label class="control-label"<% if $ID %> for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
<label class="$Silverstrap.small_right_label"<% if $ID %> for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
6 changes: 3 additions & 3 deletions templates/forms/Literal_holder.ss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="form-group"><% if $Title %>
<label class="control-label col-sm-3"<% if $ID %> for="$ID"<% end_if %>>$Title</label><% end_if %>
<div class="<% if not $Title %>col-sm-offset-3 <% end_if %>col-sm-9">
<div class="$Silverstrap.group"><% if $Title %>
<label class="$Silverstrap.label"<% if $ID %> for="$ID"<% end_if %>>$Title</label><% end_if %>
<div class="<% if not $Title %>$Silverstrap.no_label <% end_if %>$Silverstrap.holder">
$Field
</div>
</div>
4 changes: 2 additions & 2 deletions templates/forms/OptionsetField_holder_small.ss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if $Title %><label class="control-label"<% if $ID %> for="$ID"<% end_if %>>$Title</label><% end_if %>
<% if $Title %><label class="$Silverstrap.small_label"<% if $ID %> for="$ID"<% end_if %>>$Title</label><% end_if %>
<div>
$Field
</div><% if $RightTitle %>
<label class="control-label"<% if $ID %> for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
<label class="$Silverstrap.small_right_label"<% if $ID %> for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
2 changes: 1 addition & 1 deletion templates/forms/TextareaField.ss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<textarea class="form-control $extraClass" $getAttributesHTML('class')<% if $isReadonly %> readonly<% else_if $isDisabled %> disabled<% end_if %>>$Value</textarea>
<textarea class="$Silverstrap.control $extraClass" $getAttributesHTML('class')<% if $isReadonly %> readonly<% else_if $isDisabled %> disabled<% end_if %>>$Value</textarea>

0 comments on commit c1f32b8

Please sign in to comment.