Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update css and allow js options

  • Loading branch information...
commit 00e69387c1240344e72cff9c890bed5febe0e28b 1 parent 52ca709
@vangheem vangheem authored
View
9 plone/widgets/archetypes/__init__.py
@@ -1,3 +1,4 @@
+import json
from AccessControl import ClassSecurityInfo
from Products.Archetypes.Widget import TypesWidget
@@ -8,7 +9,13 @@ class ChosenWidget(TypesWidget):
_properties.update({
'macro': "chosen",
'helper_js': ('++resource++plonewidgets/chosen.js',),
- 'helper_css': ('++resource++plonewidgets/chosen.css',)
+ 'helper_css': ('++resource++plonewidgets/chosen.css',),
+ 'js_options': {}
})
security = ClassSecurityInfo()
+
+ def javascript(self):
+ return """
+jq('select.chosen').chosen(%s);
+""" % json.dumps(self.js_options)
View
22 plone/widgets/resources/chosen.css
@@ -137,7 +137,7 @@
}
/* @group Multi Chosen */
-.chzn-container-multi .chzn-choices {
+#content .chzn-container-multi ul.chzn-choices {
background-color: #fff;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
background-image: -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
@@ -179,7 +179,7 @@
.chzn-container-multi .chzn-choices .search-field .default {
color: #999;
}
-.chzn-container-multi .chzn-choices .search-choice {
+#content .chzn-container-multi .chzn-choices li.search-choice {
-webkit-border-radius: 3px;
-moz-border-radius : 3px;
border-radius : 3px;
@@ -198,7 +198,10 @@
border: 1px solid #b4b4b4;
line-height: 13px;
padding: 3px 19px 3px 6px;
- margin: 3px 0 3px 5px;
+ margin-top: 3px;
+ margin-right:0;
+ margin-left: 6px;
+ margin-bottom: 3px !important;
position: relative;
}
.chzn-container-multi .chzn-choices .search-choice span {
@@ -234,33 +237,34 @@
overflow-x: hidden;
overflow-y: auto;
}
-.chzn-container-multi .chzn-results {
+#content .chzn-container-multi ul.chzn-results {
margin: -1px 0 0;
+ margin-left: 0 !important;
padding: 0;
}
-.chzn-container .chzn-results li {
+#content .chzn-container .chzn-results li {
display: none;
line-height: 80%;
padding: 7px 7px 8px;
margin: 0;
list-style: none;
}
-.chzn-container .chzn-results .active-result {
+#content .chzn-container .chzn-results .active-result {
cursor: pointer;
display: list-item;
}
-.chzn-container .chzn-results .highlighted {
+#content .chzn-container .chzn-results .highlighted {
background: #3875d7;
color: #fff;
}
-.chzn-container .chzn-results li em {
+#content .chzn-container .chzn-results li em {
background: #feffde;
font-style: normal;
}
.chzn-container .chzn-results .highlighted em {
background: transparent;
}
-.chzn-container .chzn-results .no-results {
+#content .chzn-container .chzn-results li.no-results {
background: #f4f4f4;
display: list-item;
}
View
2  plone/widgets/resources/chosen.js
@@ -115,7 +115,7 @@
this.result_single_selected = null;
this.allow_single_deselect = (this.options.allow_single_deselect != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
this.disable_search_threshold = this.options.disable_search_threshold || 0;
- this.allow_add_new = this.options.allow_add_new || true;
+ this.allow_add_new = this.options.allow_add_new || false;
this.choices = 0;
return this.results_none_found = this.options.no_results_text || "No results match";
};
View
4 plone/widgets/skins/plone_widgets/chosen.pt
@@ -31,9 +31,7 @@
An existing tag
</option>
</select>
- <script type="text/javascript">
- jq('select.chosen').chosen();
- </script>
+ <script type="text/javascript" tal:content="structure widget/javascript"></script>
</div>
</div>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.