-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
386c69f
commit cef9d4e
Showing
7 changed files
with
75 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from pyforms_web.controls.control_base import ControlBase | ||
import simplejson | ||
|
||
class ControlSimpleLabel(ControlBase): | ||
def __init__(self, *args, **kwargs): | ||
self._css = '' | ||
super().__init__(*args, **kwargs) | ||
|
||
def init_form(self): | ||
return """new ControlSimpleLabel('{0}', {1})""".format( | ||
self._name, | ||
simplejson.dumps(self.serialize()) | ||
) | ||
|
||
def deserialize(self, properties): pass | ||
|
||
def serialize(self): | ||
res = super().serialize() | ||
if self.value: | ||
res.update({'value': "<br />".join(self.value.split("\n"))}) | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
class ControlSimpleLabel extends ControlBase{ | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
get_value(){ | ||
return this.properties.value; | ||
}; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
init_control(){ | ||
var html = '<div class="ui field '+this.properties.css+' control ControlSimpleLabel" id="'+this.place_id()+'" >'; | ||
if(this.properties.label){ | ||
html += '<div class="header">'; | ||
html += this.properties.label; | ||
html += '</div>'; | ||
}; | ||
|
||
html += '<p id="'+this.control_id()+'" >'; | ||
if(this.properties.value!=null || this.properties.value!=undefined) | ||
html += this.properties.value; | ||
html += '</p>'; | ||
html += '</div>'; | ||
this.jquery_place().replaceWith(html); | ||
|
||
|
||
}; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
set_value(value){ | ||
this.init_control(); | ||
}; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters