Skip to content

Commit

Permalink
Merge pull request #36 from guerler/fixradio
Browse files Browse the repository at this point in the history
Fix radiobuttons, fix tabs in styleguide
  • Loading branch information
dannon authored Apr 5, 2018
2 parents c27434b + beb8e52 commit 438158d
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 46 deletions.
47 changes: 25 additions & 22 deletions client/galaxy/docs/galaxy-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,38 @@ All the crazy permutations of menu button...
As generated by layout.masthead.js

```
<nav id="masthead" class="navbar navbar-expand justify-content-center navbar-dark bg-dark">
<a class="navbar-brand">
<img class="navbar-brand-image"/>
<span class="navbar-brand-title">Title</span>
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link">Header 1</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle">Header 2</a>
</li>
</ul>
</nav>
<nav id="masthead" class="navbar navbar-expand justify-content-center navbar-dark bg-dark">
<a class="navbar-brand">
<img class="navbar-brand-image"/>
<span class="navbar-brand-title">Title</span>
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link">Header 1</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle">Header 2</a>
</li>
</ul>
</nav>
```

## Radio Buttons

As generated by mvc.ui.ui-options

```
<div class="btn-group ui-radiobutton" data-toggle="buttons" style="display: inline-block;">
<label class="btn btn-secondary ui-option" data-original-title="" title="">
<input name="field-uid-7" value="true" type="radio">Yes
</label>
<label class="btn btn-secondary ui-option" data-original-title="" title="">
<input name="field-uid-7" value="false" type="radio">No
</label>
</div>
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="radio" name="options" id="option1" autocomplete="off" checked> Active
</label>
<label class="btn btn-secondary">
<input type="radio" name="options" id="option2" autocomplete="off"> Radio
</label>
<label class="btn btn-secondary">
<input type="radio" name="options" id="option3" autocomplete="off"> Radio
</label>
</div>
```

## Popup menus
Expand Down
6 changes: 6 additions & 0 deletions client/galaxy/scripts/mvc/ui/ui-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ var ButtonMenu = ButtonDefault.extend({
this.setElement(
$("<div/>").append(
(this.$root = $("<div/>")
.append((this.$icon = $("<i/>")))
.append((this.$title = $("<span/>"))))
)
);
Expand Down Expand Up @@ -295,10 +296,15 @@ var ButtonMenu = ButtonDefault.extend({
e.preventDefault();
options.onclick && options.onclick();
});
this.$icon
.removeClass()
.addClass("icon fa")
.addClass(options.icon);
this.$title
.removeClass()
.addClass("title")
.html(options.title);
options.icon && options.title && this.$icon.addClass("ui-margin-right");
this.$menu && this.$menu.remove();
if (this.collection.length > 0) {
this.$menu = $("<ul/>")
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/ui/ui-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ RadioButton.View = Base.extend({
/** Main template function */
_template: function() {
return $("<div/>")
.addClass("btn-group ui-radiobutton")
.addClass("btn-group btn-group-toggle")
.attr("data-toggle", "buttons");
}
});
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/ui/ui-select-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ var View = Backbone.View.extend({
var button_width = 0;
if (this.fields.length > 1) {
this.$el.append(this.button_type.$el);
button_width = `${Math.max(0, this.fields.length * 36)}px`;
button_width = `${Math.max(0, this.fields.length * 40)}px`;
}
_.each(this.fields, field => {
self.$el.append(field.$el.css({ "margin-left": button_width }));
Expand Down
16 changes: 3 additions & 13 deletions client/galaxy/style/scss/ui.scss
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ $ui-margin-horizontal-large: 10px;
.dropdown-item {
text-align: left;
}
.dropdown-toggle::after {
display: none;
}
}

.ui-button-icon-plain {
Expand Down Expand Up @@ -804,19 +807,6 @@ $ui-margin-horizontal-large: 10px;
}
}

.ui-radiobutton {
width: 100%;
label {
height: auto;
line-height: 1.5em;
}

i {
padding-right: $ui-margin-horizontal;
font-size: 1.1em;
}
}

.ui-button-check {
.icon {
font-size: 1.2em;
Expand Down
12 changes: 3 additions & 9 deletions static/style/blue/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -10144,6 +10144,9 @@ html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
.ui-button-menu .dropdown-item, .ui-button-menu ul.dropdown-menu li, ul.dropdown-menu .ui-button-menu li {
text-align: left; }

.ui-button-menu .dropdown-toggle::after {
display: none; }

.ui-button-icon-plain {
border: none !important;
background: none !important;
Expand Down Expand Up @@ -10603,15 +10606,6 @@ html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
top: 8px;
left: 10px; }

.ui-radiobutton {
width: 100%; }
.ui-radiobutton label {
height: auto;
line-height: 1.5em; }
.ui-radiobutton i {
padding-right: 5px;
font-size: 1.1em; }

.ui-button-check {
cursor: pointer;
margin-bottom: 5px; }
Expand Down

0 comments on commit 438158d

Please sign in to comment.