Bladeren bron

[spark] Adjust the snippet type for the placeholders

Johan Ahlen 10 jaren geleden
bovenliggende
commit
aa23f4a

+ 12 - 0
apps/spark/src/spark/static/spark/css/spark.css

@@ -407,6 +407,10 @@ h1.empty {
   background-color: #DDD;
 }
 
+.text-snippet {
+  padding-left: 4px;
+}
+
 .medium-editor-toolbar-form label {
   min-height: 20px;
 }
@@ -427,6 +431,14 @@ h1.empty {
   top: 40px !important;
 }
 
+.medium-editor-placeholder:after {
+  padding-left: 5px;
+  font-size: 12px !important;
+  font-family: 'Ubuntu Mono', Monaco, Consolas, monospace !important;
+  color: #D1D1D1 !important;
+  font-style: normal !important;
+}
+
 @media print {
   .navigator, .assist-container, .result-settings, .left-panel, a.btn, button, .CodeMirror-gutters, .add-snippet {
     display: none !important;

+ 1 - 1
apps/spark/src/spark/templates/editor_components.mako

@@ -608,7 +608,7 @@ from django.utils.translation import ugettext as _
 </script>
 
 <script type="text/html" id="text-snippet-body">
-  <div data-bind="attr:{'id': 'editor_'+id()}, html: statement_raw, value: statement_raw, medium: {}" class="text-snippet"></div>
+  <div data-bind="attr:{'id': 'editor_' + id()}, html: statement_raw, value: statement_raw, medium: {}" data-placeHolder="${ _('Type your text here, select some text to format it') }" class="text-snippet"></div>
 </script>
 
 <script type="text/html" id="executable-snippet-body">

+ 5 - 6
apps/spark/src/spark/views.py

@@ -55,12 +55,11 @@ def notebook(request):
       'options_json': json.dumps({
           'languages': LANGUAGES.get(),
           'snippet_placeholders' : {
-              'scala': _('/** Example: 1 + 1, or press CTRL + space */'),
-              'python': _('# Example: 1 + 1, or press CTRL + space'),
-              'impala': _('-- Example: SELECT * FROM tablename, or press CTRL + space'),
-              'hive': _('-- Example: SELECT * FROM tablename, or press CTRL + space'),
-              'text': _('<h2>This is a text snippet</h2>Type your text here'),
-              'r': _('# Example: 1 + 1, or press CTRL + space')
+              'spark': _('Example: 1 + 1, or press CTRL + space'),
+              'pyspark': _('Example: 1 + 1, or press CTRL + space'),
+              'impala': _('Example: SELECT * FROM tablename, or press CTRL + space'),
+              'hive': _('Example: SELECT * FROM tablename, or press CTRL + space'),
+              'r': _('Example: 1 + 1, or press CTRL + space')
           },
           'session_properties': SparkApi.PROPERTIES
       }),