Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

alert of old ruby version for end of ruby 1.8 #267

	* show an alert message top of config page
	* hide the message after click close button
	* save option 'old_ruby_alert.hide' as true
  • Loading branch information...
commit fac629a213337fb1c96478bd660293df4cd28b9d 1 parent f607ef3
@tdtds tdtds authored
View
1  ChangeLog
@@ -1,5 +1,6 @@
2013-03-13 TADA Tadashi <t@tdtds.jp>
* tdiary/server.rb: fix js not load
+ * alert of old ruby version for end of ruby 1.8
2013-02-10 MATSUOKA Kohei <kohei@machu.jp>
* tdiary/view.rb, js/comment_ajax.js: post comment with ajax
View
20 js/01conf.js
@@ -39,4 +39,24 @@ $(function(){
});
return false;
});
+
+ /*
+ * old ruby alert
+ */
+ $('#alert-old-ruby').on('click', function(){
+ var data = 'conf=old_ruby_alert;saveconf=OK';
+ var csrf_key = $('#conf-form input[name=csrf_protection_key]').attr('value');
+ if (csrf_key){ data += ';csrf_protection_key=' + csrf_key; }
+
+ $.ajax({
+ url: $('#conf-form').attr('action'),
+ type: 'POST',
+ dataType: 'html',
+ data: data
+ }).done(function(html){
+ $('.alert-warn').hide();
+ }).fail(function(XMLHttpRequest, textStatus, errorThrown){
+ alert('failed saving settings.' + textStatus);
+ });
+ });
});
View
25 plugin/00default.rb
@@ -982,6 +982,31 @@ def saveconf_recommendfilter
end
end
+#
+# old ruby alert
+#
+def old_ruby_alert
+ if RUBY_VERSION < '1.9' and !@conf['old_ruby_alert.hide']
+ %Q|<div class="alert-warn">
+ <a href="#" class="action-button" id="alert-old-ruby">&times;</a>
+ #{old_ruby_alert_message}
+ </div>|
+ else
+ ''
+ end
+end
+
+def old_ruby_alert_message
+ "お使いのRuby #{RUBY_VERSION}は次のリリースからサポート対象外になります。"
+end
+
+add_conf_proc( 'old_ruby_alert', nil) do
+ if @mode == 'saveconf'
+ @conf['old_ruby_alert.hide'] = true
+ end
+ %Q|<h3>OLD RUBY ALERT</h3>| # dummy
+end
+
# Local Variables:
# mode: ruby
# indent-tabs-mode: t
View
7 plugin/en/00default.rb
@@ -375,6 +375,13 @@ def comment_mail_basic_html
HTML
end
+#
+# old ruby alert
+#
+def old_ruby_alert_message
+ "The ruby #{RUBY_VERSION} will be unsupported by tDiary next release."
+end
+
# Local Variables:
# mode: ruby
# indent-tabs-mode: t
View
1  skel/conf.rhtml
@@ -1,5 +1,6 @@
<%%=navi%>
<h1><%=h @conf.html_title %>(<%%=h navi_preference%>) - <%%=h conf_label( <%=@key.dump%> )%><%%=help( <%=@key.dump%> + '.rb' )%></h1>
+<%%= old_ruby_alert %>
<div class="sidebar">
<%% each_conf_genre do |genre|%>
<div class="block">
View
43 theme/conf.css
@@ -28,6 +28,49 @@ a:visited {
color: #A8B392;
}
+div.alert-warn {
+ background-color: #faa;
+ border-style: solid;
+ border-color: #f88;
+ border-width: 1px;
+ border-radius: 8px;
+ padding: 4px 8px;
+ margin: 1em auto;
+ width: 80%;
+ zoom: 100%;
+}
+
+.action-button {
+ float: right;
+ border-style: solid;
+ border-color: transparent;
+ border-width: 1px;
+ border-radius: 8px;
+ padding: 0px 4px;
+ color: #000;
+}
+.action-button:hover {
+ background-color: #f88;
+ border-style: solid;
+ border-color: #f55;
+ border-width: 1px;
+ border-radius: 8px;
+ padding: 0px 4px;
+}
+.action-button:link,
+.action-button:visited {
+ color: #000;
+ text-decoration: none;
+}
+
+div.alert-warn:after {
+ content: "";
+ height: 0;
+ visibility: hidden;
+ display: block;
+ clear: both;
+}
+
div.adminmenu {
font-size: 80%;
margin: 3px 0px 3px 0px;
Please sign in to comment.
Something went wrong with that request. Please try again.