2
0
Ver Fonte

Helios: restore the "Open" dropdown

Nicolas Petton há 10 anos atrás
pai
commit
401da54fbf
4 ficheiros alterados com 53 adições e 20 exclusões
  1. 16 1
      css/helios.css
  2. 22 4
      css/helios.less
  3. 9 9
      src/Helios-Core.js
  4. 6 6
      src/Helios-Core.st

+ 16 - 1
css/helios.css

@@ -164,9 +164,24 @@ body[id="helios"] .navbar .nav > li {
   line-height: 16px;
   text-align: center;
 }
-body[id="helios"] .navbar .nav > li .new_tab {
+body[id="helios"] .new_tab {
   width: 60px;
   border-right: 0 none;
+  position: absolute;
+  top: 0px;
+  right: 0px;
+  z-index: 2000;
+}
+body[id="helios"] .new_tab a {
+  color: #444;
+}
+body[id="helios"] .new_tab a:hover {
+  text-decoration: none;
+}
+body[id="helios"] .new_tab .dropdown-menu {
+  left: auto;
+  float: right;
+  right: 0;
 }
 body[id="helios"] .dropdown-menu {
   min-width: 0;

+ 22 - 4
css/helios.less

@@ -195,12 +195,30 @@ body[id="helios"] {
 		> li {
 			line-height: 16px;
 			text-align: center;
-			
-			.new_tab {
-				width: 60px;
-				border-right: 0 none;
+		}
+	}
+
+	.new_tab {
+		width: 60px;
+		border-right: 0 none;
+		position: absolute;
+		top: 0px;
+		right: 0px;
+		z-index: 2000;
+
+		a {
+			color: #444;
+
+			&:hover {
+				text-decoration: none;
 			}
 		}
+		
+		.dropdown-menu {
+			left: auto;
+			float: right;
+			right: 0;
+		}
 	}
 
 	.dropdown-menu {

+ 9 - 9
src/Helios-Core.js

@@ -6361,15 +6361,14 @@ var self=this;
 function $HLWidget(){return globals.HLWidget||(typeof HLWidget=="undefined"?nil:HLWidget)}
 return smalltalk.withContext(function($ctx1) { 
 var $1,$3,$4,$5,$7,$8,$9,$6,$2;
-$1=_st(html)._li();
-$ctx1.sendIdx["li"]=1;
-_st($1)._class_("dropdown");
+$1=_st(html)._div();
+_st($1)._class_("dropdown new_tab");
 $ctx1.sendIdx["class:"]=1;
 $2=_st($1)._with_((function(){
 return smalltalk.withContext(function($ctx2) {
 $3=_st(html)._a();
 $ctx2.sendIdx["a"]=1;
-_st($3)._class_("new_tab dropdown-toggle");
+_st($3)._class_("dropdown-toggle");
 $ctx2.sendIdx["class:"]=2;
 _st($3)._at_put_("data-toggle","dropdown");
 $4=_st($3)._with_((function(){
@@ -6414,8 +6413,8 @@ return $6;
 $ctx1.sendIdx["with:"]=1;
 return self}, function($ctx1) {$ctx1.fill(self,"renderAddOn:",{html:html},globals.HLTabsWidget)})},
 args: ["html"],
-source: "renderAddOn: html\x0a    html li \x0a    \x09class: 'dropdown';\x0a        with: [ \x0a\x09\x09\x09html a \x0a        \x09\x09class: 'new_tab dropdown-toggle';\x0a           \x09 \x09at: 'data-toggle' put: 'dropdown';\x0a            \x09with: [ \x0a            \x09\x09html with: 'Open...'.\x0a  \x09\x09\x09\x09\x09(html tag: 'b') class: 'caret' ].\x0a           html ul \x0a           \x09\x09class: 'dropdown-menu';\x0a                with: [\x0a                  \x09((HLWidget withAllSubclasses\x0a                    \x09select: [ :each | each canBeOpenAsTab ])\x0a                        sorted: [ :a :b | a tabPriority < b tabPriority ])\x0a                        do: [ :each |\x0a  \x09\x09\x09\x09\x09\x09\x09html li with: [\x0a                      \x09\x09\x09html a \x0a                                \x09with: each tabLabel;\x0a      \x09\x09\x09\x09\x09\x09\x09\x09onClick: [ each openAsTab ] ] ] ] ]",
-messageSends: ["class:", "li", "with:", "a", "at:put:", "tag:", "ul", "do:", "sorted:", "select:", "withAllSubclasses", "canBeOpenAsTab", "<", "tabPriority", "tabLabel", "onClick:", "openAsTab"],
+source: "renderAddOn: html\x0a    html div class: 'dropdown new_tab';\x0a        with: [ \x0a\x09\x09\x09html a \x0a        \x09\x09class: 'dropdown-toggle';\x0a           \x09 \x09at: 'data-toggle' put: 'dropdown';\x0a            \x09with: [ \x0a            \x09\x09html with: 'Open...'.\x0a  \x09\x09\x09\x09\x09(html tag: 'b') class: 'caret' ].\x0a           html ul \x0a           \x09\x09class: 'dropdown-menu';\x0a                with: [\x0a                  \x09((HLWidget withAllSubclasses\x0a                    \x09select: [ :each | each canBeOpenAsTab ])\x0a                        sorted: [ :a :b | a tabPriority < b tabPriority ])\x0a                        do: [ :each |\x0a  \x09\x09\x09\x09\x09\x09\x09html li with: [\x0a                      \x09\x09\x09html a \x0a                                \x09with: each tabLabel;\x0a      \x09\x09\x09\x09\x09\x09\x09\x09onClick: [ each openAsTab ] ] ] ] ]",
+messageSends: ["class:", "div", "with:", "a", "at:put:", "tag:", "ul", "do:", "sorted:", "select:", "withAllSubclasses", "canBeOpenAsTab", "<", "tabPriority", "li", "tabLabel", "onClick:", "openAsTab"],
 referencedClasses: ["HLWidget"]
 }),
 globals.HLTabsWidget);
@@ -6443,10 +6442,11 @@ return self._renderTabsOn_(html);
 return $4;
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
 $ctx1.sendIdx["with:"]=1;
+self._renderAddOn_(html);
 return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLTabsWidget)})},
 args: ["html"],
-source: "renderContentOn: html\x0a\x09html div \x0a\x09\x09class: 'navbar navbar-fixed-top';\x0a\x09\x09with: [ html div \x0a\x09\x09\x09class: 'navbar-inner';\x0a\x09\x09\x09with: [ self renderTabsOn: html ] ]",
-messageSends: ["class:", "div", "with:", "renderTabsOn:"],
+source: "renderContentOn: html\x0a\x09html div \x0a\x09\x09class: 'navbar navbar-fixed-top';\x0a\x09\x09with: [ html div \x0a\x09\x09\x09class: 'navbar-inner';\x0a\x09\x09\x09with: [ self renderTabsOn: html ] ].\x0a\x09\x09\x09\x0a\x09self renderAddOn: html",
+messageSends: ["class:", "div", "with:", "renderTabsOn:", "renderAddOn:"],
 referencedClasses: []
 }),
 globals.HLTabsWidget);
@@ -6541,7 +6541,7 @@ return self._updateTabsOrder();
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})})]));
 return self}, function($ctx1) {$ctx1.fill(self,"renderTabsOn:",{html:html,ul:ul},globals.HLTabsWidget)})},
 args: ["html"],
-source: "renderTabsOn: html\x0a\x09| ul |\x0a\x09ul := html ul \x0a\x09\x09class: 'nav main-tabs';\x0a\x09\x09with: [ \x0a        \x09self tabs do: [ :each |\x0a\x09\x09\x09\x09self renderTab: each on: html ].\x0a\x09\x09\x09\x22self renderAddOn: html\x22 ].\x0a\x09\x09\x0a\x09ul asJQuery sortable: #{\x0a\x09\x09'start' -> [ self disableSelection ].\x0a\x09\x09'stop' -> [ [ self enableSelection] valueWithTimeout: 300 ].\x0a\x09\x09'update' -> [ self updateTabsOrder ]\x0a\x09}",
+source: "renderTabsOn: html\x0a\x09| ul |\x0a\x09ul := html ul \x0a\x09\x09class: 'nav main-tabs';\x0a\x09\x09with: [ \x0a        \x09self tabs do: [ :each |\x0a\x09\x09\x09\x09self renderTab: each on: html ] ].\x0a\x09\x09\x0a\x09ul asJQuery sortable: #{\x0a\x09\x09'start' -> [ self disableSelection ].\x0a\x09\x09'stop' -> [ [ self enableSelection] valueWithTimeout: 300 ].\x0a\x09\x09'update' -> [ self updateTabsOrder ]\x0a\x09}",
 messageSends: ["class:", "ul", "with:", "do:", "tabs", "renderTab:on:", "sortable:", "asJQuery", "disableSelection", "valueWithTimeout:", "enableSelection", "updateTabsOrder"],
 referencedClasses: []
 }),

+ 6 - 6
src/Helios-Core.st

@@ -2153,11 +2153,10 @@ setupEvents
 !HLTabsWidget methodsFor: 'rendering'!
 
 renderAddOn: html
-    html li 
-    	class: 'dropdown';
+    html div class: 'dropdown new_tab';
         with: [ 
 			html a 
-        		class: 'new_tab dropdown-toggle';
+        		class: 'dropdown-toggle';
            	 	at: 'data-toggle' put: 'dropdown';
             	with: [ 
             		html with: 'Open...'.
@@ -2180,7 +2179,9 @@ renderContentOn: html
 		class: 'navbar navbar-fixed-top';
 		with: [ html div 
 			class: 'navbar-inner';
-			with: [ self renderTabsOn: html ] ]
+			with: [ self renderTabsOn: html ] ].
+			
+	self renderAddOn: html
 !
 
 renderTab: aTab on: html
@@ -2207,8 +2208,7 @@ renderTabsOn: html
 		class: 'nav main-tabs';
 		with: [ 
         	self tabs do: [ :each |
-				self renderTab: each on: html ].
-			"self renderAddOn: html" ].
+				self renderTab: each on: html ] ].
 		
 	ul asJQuery sortable: #{
 		'start' -> [ self disableSelection ].