Skip to content

Commit

Permalink
fix i18n bug
Browse files Browse the repository at this point in the history
  • Loading branch information
farthinker committed Mar 13, 2015
1 parent ac4e50b commit 8f3eb0e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-select",
"version": "2.0.4",
"version": "2.0.5",
"homepage": "https://github.com/mycolorway/simple-select",
"authors": [
"kshift <[email protected]>"
Expand Down Expand Up @@ -31,4 +31,3 @@
"simple-util": "2.x"
}
}

2 changes: 1 addition & 1 deletion lib/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Select = (function(superClass) {
};

Select._tpl = {
select: "<div class=\"simple-select\">\n <span class=\"link-expand\" title=\"" + (Select.prototype._t('all_options')) + "\">\n <i class=\"icon-caret-down\"><span>&#9662;</span></i>\n </span>\n <span class=\"link-clear\" title=\"" + (Select.prototype._t('clear_selection')) + "\">\n <i class=\"icon-delete\"><span>&#10005;</span></i>\n </span>\n <div class=\"select-list\">\n <div class=\"loading\">" + (Select.prototype._t('loading')) + "...</div>\n </div>\n</div>",
input: "<input type=\"text\" class=\"select-result\" autocomplete=\"off\">",
item: "<div class=\"select-item\">\n <a href=\"javascript:;\" class=\"label\"><span></span></a>\n</div>"
};
Expand All @@ -68,6 +67,7 @@ Select = (function(superClass) {

Select.prototype._render = function() {
var idx, it, items, j, len, results1;
Select._tpl.select = "<div class=\"simple-select\">\n <span class=\"link-expand\" title=\"" + (this._t('all_options')) + "\">\n <i class=\"icon-caret-down\"><span>&#9662;</span></i>\n </span>\n <span class=\"link-clear\" title=\"" + (this._t('clear_selection')) + "\">\n <i class=\"icon-delete\"><span>&#10005;</span></i>\n </span>\n <div class=\"select-list\">\n <div class=\"loading\">" + (this._t('loading')) + "...</div>\n </div>\n</div>";
this.el = $(this.opts.el).hide();
this.select = $(Select._tpl.select).data("select", this).addClass(this.opts.cls).insertAfter(this.el);
this.input = $(Select._tpl.input).attr("placeholder", this.el.data("placeholder") || this.opts.placeholder).prependTo(this.select);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-select",
"version": "2.0.4",
"version": "2.0.5",
"description": "a simple select plugin based on Simple Module",
"repository": {
"type": "git",
Expand Down
30 changes: 14 additions & 16 deletions src/select.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class Select extends SimpleModule
placeholder: ""
allowInput: false


@i18n:
"zh-CN":
all_options: "所有选项"
Expand All @@ -19,20 +18,6 @@ class Select extends SimpleModule
loading: "loading"

@_tpl:
select: """
<div class="simple-select">
<span class="link-expand" title="#{@::_t('all_options')}">
<i class="icon-caret-down"><span>&#9662;</span></i>
</span>
<span class="link-clear" title="#{@::_t('clear_selection')}">
<i class="icon-delete"><span>&#10005;</span></i>
</span>
<div class="select-list">
<div class="loading">#{@::_t('loading')}...</div>
</div>
</div>
"""

input: """
<input type="text" class="select-result" autocomplete="off">
"""
Expand All @@ -43,7 +28,6 @@ class Select extends SimpleModule
</div>
"""


_init: ->
unless @opts.el
throw "simple select: option el is required"
Expand All @@ -55,6 +39,20 @@ class Select extends SimpleModule


_render: ->
Select._tpl.select = """
<div class="simple-select">
<span class="link-expand" title="#{@_t('all_options')}">
<i class="icon-caret-down"><span>&#9662;</span></i>
</span>
<span class="link-clear" title="#{@_t('clear_selection')}">
<i class="icon-delete"><span>&#10005;</span></i>
</span>
<div class="select-list">
<div class="loading">#{@_t('loading')}...</div>
</div>
</div>
"""

@el = $(@opts.el).hide()
@select = $(Select._tpl.select)
.data("select", @)
Expand Down

0 comments on commit 8f3eb0e

Please sign in to comment.