Skip to content
Browse files

全ページをSSL化対応

  • Loading branch information...
1 parent 17542e6 commit f964c84975d27d96209ca3c85e559286ac0e9919 @nsyee00 nsyee00 committed Nov 8, 2012
View
9 app.js
@@ -8,7 +8,7 @@ var httpsServer = require('https').createServer({
key: fs.readFileSync(path.join(__dirname, config.server.ssl.key)),
cert: fs.readFileSync(path.join(__dirname, config.server.ssl.cert))
}, app);
-var io = require('socket.io').listen(httpServer);
+var io = require('socket.io').listen(httpsServer);
var st = require('st'); // 静的ファイルを配信/キャッシュモジュール
var mysql = require('mysql');
var passport = require('passport'); // authentication
@@ -75,7 +75,10 @@ app.configure(function() {
app.use(express.cookieParser(config.server.cookieSecret));
app.use(express.session({
key: 'sess_id',
- cookie: { maxAge: config.server.cookieMaxAge }, // 1week
+ cookie: {
+ maxAge: config.server.cookieMaxAge, // 1week
+ secure: true
+ },
store: sessionStore
}));
app.use(flash());
@@ -137,7 +140,7 @@ passport.use(new LocalStrategy({
passport.use(new TwitterStrategy({
consumerKey: config.twitter.consumerKey,
consumerSecret: config.twitter.consumerSecret,
- callbackURL: 'http://'+config.server.host+'/auth/twitter/callback'
+ callbackURL: 'https://'+config.server.host+'/auth/twitter/callback'
},
userController.authenticateByTwitter
));
View
2 config/development.coffee
@@ -1,6 +1,6 @@
module.exports =
server:
- host: "127.0.0.1:3000"
+ host: "127.0.0.1:4430"
port: 3000
ssl:
port: 4430
View
4 config/production.coffee
@@ -1,9 +1,9 @@
-module.exports =
+moduleexports =
server:
host: "websocket.syaberi-house.com"
port: 3000
ssl:
- port: 4430
+ port: 443
key: 'certs/dev.key'
cert: 'certs/dev.crt'
cookieSecret: 'xZQWzsaY8fZWFnVltP1Y'
View
5 lib/middleware/index.js
@@ -3,11 +3,12 @@ var utils = require('../utils');
var config = require('config');
-//特定ページのSSL通信を強制
+//SSL通信を強制
exports.ssl = function(req, res, next) {
- if (!req.secure && (req.path === '/mypage' || req.path === '/users/new')) {
+ if (!req.secure) {
var host = config.server.host;
var port = config.server.ssl.port;
+ //ホスト名にポート番号が含まれる場合はドメイン名のみを切り出し
if (host.indexOf(':') > -1) {
host = host.split(':')[0];
}
View
21 public/js/dist/chatroom.js
@@ -14,6 +14,11 @@
'{{#if extImageUrl}}'+
'<img src="{{extImageUrl}}" class="owner-img">'+
'{{/if}}'+
+ '{{#if youtubeVid}}'+
+ '<iframe width="500" height="300" src="'+
+ 'http://www.youtube.com/embed/{{youtubeVid}}"'+
+ ' frameborder="0" allowfullscreen></iframe>'+
+ '{{/if}}'+
'<div class="owner-username"><a href="/users/{{userId}}">by.{{userName}}</a></div>'+
'<div class="owner-date">{{time}} [1]'+
'{{#if isHis}}'+
@@ -34,6 +39,11 @@
'{{#if extImageUrl}}'+
'<img src="{{extImageUrl}}" class="member-img">'+
'{{/if}}'+
+ '{{#if youtubeVid}}'+
+ '<iframe width="500" height="300" src="'+
+ 'http://www.youtube.com/embed/{{youtubeVid}}"'+
+ ' frameborder="0" allowfullscreen></iframe>'+
+ '{{/if}}'+
'<div class="member-username"><a href="/users/{{userId}}">by.{{userName}}</a></div>'+
'<div class="member-date">{{time}} [2]'+
'{{#if isHis}}'+
@@ -225,7 +235,8 @@
isHis: userId === data.userId, //本人の書き込みを表すフラグ
isInvite: status !== 2,
isUrlOpen: isUrlOpen,
- extImageUrl: ''
+ extImageUrl: '',
+ youtubeVid: ''
};
// urlの判断
@@ -237,6 +248,14 @@
// 画像urlで値を上書き
params.extImageUrl = tmp_url;
}
+ // Youtube の判断
+ else if (syaberi.util.isYoutube(tmp_url)) {
+ var youtube_vid = syaberi.util.getYoutubeVid(tmp_url);
+ if (youtube_vid) {
+ params.youtubeVid = youtube_vid;
+ }
+ }
+
}
//オーナーのフキダシは向きを変える
View
2 public/js/dist/chatroom.min.js
@@ -1 +1 @@
-(function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.templates=this.syaberi.templates!=null?this.syaberi.templates:this.syaberi.templates={},e.templates.chat={},e.templates.chat.chatL=Handlebars.compile('<div class="message-owner-inbox" id="chat-content-{{chatId}}"><div class="owner-icon"><a href="/users/{{userId}}"><img class="icon_m" src="{{userImage}}"></a></div><div class="owner-titlebox"><p class="owner-title">{{{message}}}</p>{{#if extImageUrl}}<img src="{{extImageUrl}}" class="owner-img">{{/if}}<div class="owner-username"><a href="/users/{{userId}}">by.{{userName}}</a></div><div class="owner-date">{{time}} [1]{{#if isHis}}<img src="/img/remove.gif" width="12" height="12" alt="閉じる" class="delete_cmt" data-chatid="{{chatId}}">{{/if}}</div></div></div>'),e.templates.chat.chatR=Handlebars.compile('<div class="message-member-inbox" id="chat-content-{{chatId}}"><div class="member-icon"><a href="/users/{{userId}}"><img class="icon_m" src="{{userImage}}"></a></div><div class="member-titlebox"><p class="member-title">{{{message}}}</p>{{#if extImageUrl}}<img src="{{extImageUrl}}" class="member-img">{{/if}}<div class="member-username"><a href="/users/{{userId}}">by.{{userName}}</a></div><div class="member-date">{{time}} [2]{{#if isHis}}<img src="/img/remove.gif" width="12" height="12" alt="閉じる" class="delete_cmt" data-chatid="{{chatId}}">{{/if}}</div>{{#if isInvite}}{{#unless isUrlOpen}}{{#if isOwner}}<a href="javascript:void(0);" class="start_chat" data-userid="{{userId}}" data-chatid="{{chatId}}">[招待]</a>{{/if}}{{/unless}}{{/if}}</div></div>')}).call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.Chat=Backbone.Model.extend({id:null,userId:null,userName:null,type:null,body:null,image:null,time:null,url:"/chats"}),e.Chats=Backbone.Collection.extend({model:e.Chat,url:"/chats"})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={},t=1,n=2,r=3;e.ChatView=Backbone.View.extend({el:$("html"),events:{"click #submit_1":"submit","keydown #message1":"keydown","click img.delete_cmt":"destroy","click a.start_chat":"invite","change #uploadings_input":"upload","change #message1":"uploadOff"},initialize:function(){this.collection=new e.Chats,this.uploadCancelFlg=0,this.token=$("#token").val()},submit:function(n){var r=$.trim($("#message1").val());if(r&&r!==""){var i=$("html").data("chatroom"),s=$("html").data("userid"),o=$("html").data("username"),u=$("html").data("userimage"),a=$("html").data("urlopen");return e.socket.emit("message",{mode:"create",chatroomId:i,userId:s,userName:o,userImage:u,message:r,type:t,isUrlOpen:a,token:this.token}),this.clearInputUserMessage(),!1}},keydown:function(e){if(e.shiftKey!==!0&&e.keyCode===13)return this.submit(e),!1},destroy:function(t){if(window.confirm("本当に削除しますか?")){var n=$(t.target),r=n.data("chatid"),i=$("html").data("chatroom"),s=$("html").data("userid");e.socket.emit("message",{mode:"destroy",chatroomId:i,chatId:r,userId:s,token:this.token})}},invite:function(e){var t=$(e.target),n=t.data("userid"),r=t.data("chatid"),i=$("html").data("chatroom");window.confirm("このユーザとチャットを開始しますか?")&&$.ajax({type:"POST",url:"/chatrooms/"+i+"/invite",data:"member="+n+"&chat="+r,success:function(e){location.href="/chatrooms/"+i+"/open"}})},upload:function(){$("#uploadings_input").upload("/upload",function(e){if(e){var t=e,n=t.split('": "'),r=n[1].split('"}</pre>'),i=$("input#uploadings_input").val().split("\\"),s;for(var o=0;o<i.length;o++)if(i[o].indexOf(".jpg")!=-1||i[o].indexOf(".jpeg")!=-1||i[o].indexOf(".JPG")!=-1||i[o].indexOf(".png")!=-1||i[o].indexOf(".PNG")!=-1||i[o].indexOf(".gif")!=-1||i[o].indexOf(".GIF")!=-1)s=i[o];$("#message1").val(s),this.uploadCancelFlg=1,$("#message1").attr("disabled","disabled"),$("#realUpfile").val(r[0])}},"html")},uploadOff:function(){$("#message1").removeAttr("disabled"),this.uploadCancelFlg===1&&($("input#uploadings_input").val(""),this.uploadCancelFlg=0)},appendMessage:function(t){var n,r=$("html").data("status"),i=$("html").data("urlopen"),s=$("html").data("userid"),o=$("html").data("ownerid"),u={chatId:t.chatId,userImage:t.userImage,userId:t.userId,userName:t.userName,time:t.time,message:t.message,isOwner:s===o,isHis:s===t.userId,isInvite:r!==2,isUrlOpen:i,extImageUrl:""};if(e.util.isUrl(t.message)){var a=e.util.getUrl(t.message);e.util.isImageUrl(a)&&(u.extImageUrl=a)}o===t.userId?n=e.templates.chat.chatL(u):n=e.templates.chat.chatR(u),$("#lines1").append(n),!i&&t.userId===s&&o!=s&&$("#section_thread_bottom").animate({height:"hide",opacity:"hide"},"slow")},destroyMessage:function(e){var t=e.chatId,n=$("html").data("userid"),r=$("html").data("ownerid");n&&r!=n&&e.userId===n&&$("#section_thread_bottom").animate({height:"show",opacity:"1.0"},"slow"),$("#chat-content-"+t).animate({height:"hide",opacity:"hide"},"slow",function(){$("#chat-content-"+t).remove()})},render:function(){},clearInputUserMessage:function(){$("#message1").val("").focus(),$("#html_image_preview").remove(),$("#user_up_img").remove(),$("#drop_message").show()}})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={},t=$("html").data("host"),n=$("html").data("chatroom"),r=$("html").data("urlopen"),i;r?i=t+"/chatrooms/"+n+"/open?id="+n+"&urlopen="+r:i=t+"/chatrooms/"+n+"?id="+n,e.socket=io.connect(i),$(function(){var t=new e.ChatView;t.render(),Backbone.emulateHTTP=!0,e.socket.on("connect",function(){}),e.socket.on("message",function(e){e.mode==="create"?t.appendMessage(e):e.mode==="destroy"&&t.destroyMessage(e)}),e.socket.on("disconnect",function(e){})})}.call(this);
+(function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.templates=this.syaberi.templates!=null?this.syaberi.templates:this.syaberi.templates={},e.templates.chat={},e.templates.chat.chatL=Handlebars.compile('<div class="message-owner-inbox" id="chat-content-{{chatId}}"><div class="owner-icon"><a href="/users/{{userId}}"><img class="icon_m" src="{{userImage}}"></a></div><div class="owner-titlebox"><p class="owner-title">{{{message}}}</p>{{#if extImageUrl}}<img src="{{extImageUrl}}" class="owner-img">{{/if}}{{#if youtubeVid}}<iframe width="500" height="300" src="http://www.youtube.com/embed/{{youtubeVid}}" frameborder="0" allowfullscreen></iframe>{{/if}}<div class="owner-username"><a href="/users/{{userId}}">by.{{userName}}</a></div><div class="owner-date">{{time}} [1]{{#if isHis}}<img src="/img/remove.gif" width="12" height="12" alt="閉じる" class="delete_cmt" data-chatid="{{chatId}}">{{/if}}</div></div></div>'),e.templates.chat.chatR=Handlebars.compile('<div class="message-member-inbox" id="chat-content-{{chatId}}"><div class="member-icon"><a href="/users/{{userId}}"><img class="icon_m" src="{{userImage}}"></a></div><div class="member-titlebox"><p class="member-title">{{{message}}}</p>{{#if extImageUrl}}<img src="{{extImageUrl}}" class="member-img">{{/if}}{{#if youtubeVid}}<iframe width="500" height="300" src="http://www.youtube.com/embed/{{youtubeVid}}" frameborder="0" allowfullscreen></iframe>{{/if}}<div class="member-username"><a href="/users/{{userId}}">by.{{userName}}</a></div><div class="member-date">{{time}} [2]{{#if isHis}}<img src="/img/remove.gif" width="12" height="12" alt="閉じる" class="delete_cmt" data-chatid="{{chatId}}">{{/if}}</div>{{#if isInvite}}{{#unless isUrlOpen}}{{#if isOwner}}<a href="javascript:void(0);" class="start_chat" data-userid="{{userId}}" data-chatid="{{chatId}}">[招待]</a>{{/if}}{{/unless}}{{/if}}</div></div>')}).call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.Chat=Backbone.Model.extend({id:null,userId:null,userName:null,type:null,body:null,image:null,time:null,url:"/chats"}),e.Chats=Backbone.Collection.extend({model:e.Chat,url:"/chats"})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={},t=1,n=2,r=3;e.ChatView=Backbone.View.extend({el:$("html"),events:{"click #submit_1":"submit","keydown #message1":"keydown","click img.delete_cmt":"destroy","click a.start_chat":"invite","change #uploadings_input":"upload","change #message1":"uploadOff"},initialize:function(){this.collection=new e.Chats,this.uploadCancelFlg=0,this.token=$("#token").val()},submit:function(n){var r=$.trim($("#message1").val());if(r&&r!==""){var i=$("html").data("chatroom"),s=$("html").data("userid"),o=$("html").data("username"),u=$("html").data("userimage"),a=$("html").data("urlopen");return e.socket.emit("message",{mode:"create",chatroomId:i,userId:s,userName:o,userImage:u,message:r,type:t,isUrlOpen:a,token:this.token}),this.clearInputUserMessage(),!1}},keydown:function(e){if(e.shiftKey!==!0&&e.keyCode===13)return this.submit(e),!1},destroy:function(t){if(window.confirm("本当に削除しますか?")){var n=$(t.target),r=n.data("chatid"),i=$("html").data("chatroom"),s=$("html").data("userid");e.socket.emit("message",{mode:"destroy",chatroomId:i,chatId:r,userId:s,token:this.token})}},invite:function(e){var t=$(e.target),n=t.data("userid"),r=t.data("chatid"),i=$("html").data("chatroom");window.confirm("このユーザとチャットを開始しますか?")&&$.ajax({type:"POST",url:"/chatrooms/"+i+"/invite",data:"member="+n+"&chat="+r,success:function(e){location.href="/chatrooms/"+i+"/open"}})},upload:function(){$("#uploadings_input").upload("/upload",function(e){if(e){var t=e,n=t.split('": "'),r=n[1].split('"}</pre>'),i=$("input#uploadings_input").val().split("\\"),s;for(var o=0;o<i.length;o++)if(i[o].indexOf(".jpg")!=-1||i[o].indexOf(".jpeg")!=-1||i[o].indexOf(".JPG")!=-1||i[o].indexOf(".png")!=-1||i[o].indexOf(".PNG")!=-1||i[o].indexOf(".gif")!=-1||i[o].indexOf(".GIF")!=-1)s=i[o];$("#message1").val(s),this.uploadCancelFlg=1,$("#message1").attr("disabled","disabled"),$("#realUpfile").val(r[0])}},"html")},uploadOff:function(){$("#message1").removeAttr("disabled"),this.uploadCancelFlg===1&&($("input#uploadings_input").val(""),this.uploadCancelFlg=0)},appendMessage:function(t){var n,r=$("html").data("status"),i=$("html").data("urlopen"),s=$("html").data("userid"),o=$("html").data("ownerid"),u={chatId:t.chatId,userImage:t.userImage,userId:t.userId,userName:t.userName,time:t.time,message:t.message,isOwner:s===o,isHis:s===t.userId,isInvite:r!==2,isUrlOpen:i,extImageUrl:"",youtubeVid:""};if(e.util.isUrl(t.message)){var a=e.util.getUrl(t.message);if(e.util.isImageUrl(a))u.extImageUrl=a;else if(e.util.isYoutube(a)){var f=e.util.getYoutubeVid(a);f&&(u.youtubeVid=f)}}o===t.userId?n=e.templates.chat.chatL(u):n=e.templates.chat.chatR(u),$("#lines1").append(n),!i&&t.userId===s&&o!=s&&$("#section_thread_bottom").animate({height:"hide",opacity:"hide"},"slow")},destroyMessage:function(e){var t=e.chatId,n=$("html").data("userid"),r=$("html").data("ownerid");n&&r!=n&&e.userId===n&&$("#section_thread_bottom").animate({height:"show",opacity:"1.0"},"slow"),$("#chat-content-"+t).animate({height:"hide",opacity:"hide"},"slow",function(){$("#chat-content-"+t).remove()})},render:function(){},clearInputUserMessage:function(){$("#message1").val("").focus(),$("#html_image_preview").remove(),$("#user_up_img").remove(),$("#drop_message").show()}})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={},t=$("html").data("host"),n=$("html").data("chatroom"),r=$("html").data("urlopen"),i;r?i=t+"/chatrooms/"+n+"/open?id="+n+"&urlopen="+r:i=t+"/chatrooms/"+n+"?id="+n,e.socket=io.connect(i),$(function(){var t=new e.ChatView;t.render(),Backbone.emulateHTTP=!0,e.socket.on("connect",function(){}),e.socket.on("message",function(e){e.mode==="create"?t.appendMessage(e):e.mode==="destroy"&&t.destroyMessage(e)}),e.socket.on("disconnect",function(e){})})}.call(this);
View
24 public/js/dist/common.js
@@ -14713,12 +14713,32 @@ Handlebars.template = Handlebars.VM.template;
if (url.length == 0) {
return false;
}
- url.match(/(\.(jpg|jpeg|gif|png)$)/i);
- if (RegExp.$1 != null && RegExp.$1.length > 0) {
+ if (url.match(/\.(jpg|jpeg|gif|png)$/i)) {
+ return true;
+ }
+ return false;
+ },
+ // Youtube の判定
+ isYoutube: function(url) {
+ if (url.length == 0) {
+ return false;
+ }
+ if (url.indexOf('youtube.com')) {
return true;
}
return false;
+ },
+ // Youtube の動画ID取得
+ getYoutubeVid: function(url) {
+ if (url.length == 0) {
+ return false;
+ }
+ var youtube_vid = url.match(/[&\?]v=([\d\w-]+)/);
+ if (youtube_vid[1]) {
+ return youtube_vid[1];
+ }
+ return false;
}
};
View
2 public/js/dist/common.min.js
1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
View
66 public/js/dist/mypage.js
@@ -9,17 +9,17 @@
'<div class="room">'+
'<div class="room-inbox">'+
'<div class="room-icon">'+
- '<a href="http://{{host}}{{chatroom.ownerpage}}">'+
+ '<a href="{{chatroom.ownerpage}}">'+
'<img class="icon_m" src="{{chatroom.ownerimage}}">'+
'</a>'+
'</div>'+
'<div class="room-titlebox">'+
- '<h2 class="room-title"><a href="http://{{host}}/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}">{{chatroom.title}}</a></h2>'+
+ '<h2 class="room-title"><a href="/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}">{{chatroom.title}}</a></h2>'+
'<div class="cat-icon"><a href="#">{{chatroom.category}}</a></div>'+
- '<div class="room-username"><a href="http://{{host}}{{chatroom.ownerpage}}">by.{{chatroom.owner}}</a></div>'+
+ '<div class="room-username"><a href="{{chatroom.ownerpage}}">by.{{chatroom.owner}}</a></div>'+
'</div>'+
'<div class="room-button">'+
- '<a href="http://{{host}}/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}">'+
+ '<a href="/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}">'+
'<input type="button" class="button_yg" value="話す">'+
'</a>'+
'</div>'+
@@ -29,36 +29,34 @@
//プロフィール編集
syaberi.templates.mypage.profile = Handlebars.compile(
- '<form action="" method="">'+
- '<table id="makecommunity_table">'+
- '<tr>'+
- '<th>ニックネーム<br><span style="color:#FF1881">※必須</span></th>'+
- '<td>'+
- '<div class="input_makecommunity_name_area"><input type="text" name="userName" id="userName" value="{{{userName}}}"></div>'+
- '<span id="error_userName" class="error"></span>'+
- '</td>'+
- '</tr>'+
- '<tr>'+
- '<th>メールアドレス<br><span style="color:#FF1881">※必須</span></th>'+
- '<td>'+
- '<div class="input_makecommunity_name_area"><input type="text" name="email" id="email" value="{{email}}"></div>'+
- '<span id="error_email" class="error"></span>'+
- '</td>'+
- '</tr>'+
- '<tr>'+
- '<th>紹介文</th>'+
- '<td>'+
- '<div class="input_makecommunity_name_area">'+
- '<textarea name="description" id="description" cols="80" rows="8">{{{description}}}</textarea>'+
- '</div>'+
- '<span id="error_description" class="error"></span>'+
- '</td>'+
- '</tr>'+
- '</table>'+
- '<div class="txtc magt20 magb200">'+
- '<input type="button" class="button_g full_width" id="submit_1" value="保存">'+
- '</div>'+
- '</form>'
+ '<form method="" action="" style="padding-top:20px;">'+
+ '<table>'+
+ '<tr>'+
+ '<th class="label">ニックネーム:<div class="necessity">※必須</div></th>'+
+ '<td class="data">'+
+ '<input type="text" name="userName" id="userName" class="text-box" value="{{{userName}}}">'+
+ '<div id="error_userName" class="error"></div>'+
+ '</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th class="label">メールアドレス:<div class="necessity">※必須</div></th>'+
+ '<td class="data">'+
+ '<input type="text" name="email" id="email" class="text-box" value="{{{email}}}">'+
+ '<div id="error_email" class="error"></div>'+
+ '</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th class="label">プロフィール:</th>'+
+ '<td class="data">'+
+ '<textarea name="description" id="description" class="textarea-box">{{{description}}}</textarea>'+
+ '<div id="error_description" class="error"></div>'+
+ '</td>'+
+ '</tr>'+
+ '</table>'+
+ '<div class="submit">'+
+ '<input type="button" class="button_g" id="submit_1" value="保存">'+
+ '</div>'+
+ '</form>'
);
}).call(this);
View
2 public/js/dist/mypage.min.js
@@ -1 +1 @@
-(function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.templates=this.syaberi.templates!=null?this.syaberi.templates:this.syaberi.templates={},e.templates.mypage={},e.templates.mypage.list=Handlebars.compile('<div class="room"><div class="room-inbox"><div class="room-icon"><a href="http://{{host}}{{chatroom.ownerpage}}"><img class="icon_m" src="{{chatroom.ownerimage}}"></a></div><div class="room-titlebox"><h2 class="room-title"><a href="http://{{host}}/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}">{{chatroom.title}}</a></h2><div class="cat-icon"><a href="#">{{chatroom.category}}</a></div><div class="room-username"><a href="http://{{host}}{{chatroom.ownerpage}}">by.{{chatroom.owner}}</a></div></div><div class="room-button"><a href="http://{{host}}/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}"><input type="button" class="button_yg" value="話す"></a></div></div></div>'),e.templates.mypage.profile=Handlebars.compile('<form action="" method=""><table id="makecommunity_table"><tr><th>ニックネーム<br><span style="color:#FF1881">※必須</span></th><td><div class="input_makecommunity_name_area"><input type="text" name="userName" id="userName" value="{{{userName}}}"></div><span id="error_userName" class="error"></span></td></tr><tr><th>メールアドレス<br><span style="color:#FF1881">※必須</span></th><td><div class="input_makecommunity_name_area"><input type="text" name="email" id="email" value="{{email}}"></div><span id="error_email" class="error"></span></td></tr><tr><th>紹介文</th><td><div class="input_makecommunity_name_area"><textarea name="description" id="description" cols="80" rows="8">{{{description}}}</textarea></div><span id="error_description" class="error"></span></td></tr></table><div class="txtc magt20 magb200"><input type="button" class="button_g full_width" id="submit_1" value="保存"></div></form>')}).call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.User=Backbone.Model.extend({id:null,userName:null,email:null,description:null,validation:{userName:[{required:!0,msg:"ニックネームを入力してください"},{rangeLength:[1,255],msg:"ニックネームは255文字以下で入力してください"}],email:[{required:!0,msg:"メールアドレスを入力してください"},{pattern:"email",msg:"メールアドレスの形式が不正です。"},{rangeLength:[3,255],msg:"メールアドレスは3文字以上255文字以下で入力してください"}],description:[]},url:"/users"}),e.Users=Backbone.Collection.extend({model:e.User,url:"/users"})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.Chatroom=Backbone.Model.extend({id:null,title1:null,title2:null,description:null,categoryId:null,userId:null,publicYN:null,validation:{categoryId:[{required:!0,msg:"カテゴリを選択してください"}],title1:[{required:!0,msg:"部屋名を入力してください"},{rangeLength:[0,100],msg:"部屋名は100文字以下で入力してください"}],title2:[{required:!0,msg:"部屋名を入力してください"},{rangeLength:[0,100],msg:"部屋名は100文字以下で入力してください"}],description:[],publicYN:[{required:!0,msg:"公開設定を選択してください"}]},url:"/chatrooms"}),e.Chatrooms=Backbone.Collection.extend({model:e.Chatroom,url:"/chatrooms",nextPage:2,parse:function(e){return this.nextPage=e.nextPage,e.chatrooms}})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.MyPageView=Backbone.View.extend({el:$("html"),events:{"click #owner-chatrooms":"getOwnerChatrooms","click #entry-chatrooms":"getEntryChatrooms","click #join-chatrooms":"getJoinChatrooms","click #edit-profile":"showProfile","click #submit_1":"editProfile","click #view-more-events":"getMore"},initialize:function(){this.model=new e.User,this.collection=new e.Chatrooms,this.mode="owner",this.token=$("#token").val(),Backbone.Validation.bind(this)},getOwnerChatrooms:function(e){this.init_list(),$("li","#owner-chatrooms").addClass("active"),this.mode="owner",this.getChatrooms()},getEntryChatrooms:function(e){this.init_list(),$("li","#entry-chatrooms").addClass("active"),this.mode="entry",this.getChatrooms()},getJoinChatrooms:function(e){this.init_list(),$("li","#join-chatrooms").addClass("active"),this.mode="join",this.getChatrooms()},getMore:function(e){var t=this.collection.nextPage;this.getChatrooms(t)},getChatrooms:function(t){var n=this;t=t||1;var r=$("html").data("profileid");$("#view-more-events").hide(),$("#view-more-loader").show(),this.collection.fetch({data:{profileId:r,mode:this.mode,page:t},success:function(t,r){var i=r.chatrooms;i&&$.each(r.chatrooms,function(t,r){var i=e.templates.mypage.list({host:$("html").data("host"),chatroom:r,isUrlOpen:n.mode==="entry"?!1:!0});$("#article_area").append(i)}),$("#view-more-loader").hide(),r.nextPage!==0&&$("#view-more-events").show()}})},showProfile:function(t){var n=$("html").data("profilename"),r=$("html").data("profileemail"),i=$("html").data("profiledescription");this.init_list(),$("li","#edit-profile").addClass("active");var s=e.templates.mypage.profile({userName:n,email:r,description:i});$("#article_area").append(s)},editProfile:function(e){e.preventDefault();var t=$("html").data("profileid"),n=$.trim($("#userName").val()),r=$.trim($("#email").val()),i=$.trim($("#description").val());this.model.set({userId:t,userName:n,email:r,description:i,isUpdate:!0}),this.model.isValid()&&this.model.save({userId:t,userName:n,email:r,description:i,token:this.token},{success:function(){location.href="/mypage"},error:function(e,t){alert(t.responseText)}}),this.model.bind("validated:invalid",function(e,t){for(key in t)$("#error_"+key).text(t[key])})},render:function(){this.getOwnerChatrooms()},init_list:function(){return $("li","#owner-chatrooms").removeClass("active"),$("li","#join-chatrooms").removeClass("active"),$("li","#edit-profile").removeClass("active"),$("#article_area").empty()}})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};$(function(){var t=new e.MyPageView;t.render(),Backbone.emulateHTTP=!0})}.call(this);
+(function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.templates=this.syaberi.templates!=null?this.syaberi.templates:this.syaberi.templates={},e.templates.mypage={},e.templates.mypage.list=Handlebars.compile('<div class="room"><div class="room-inbox"><div class="room-icon"><a href="{{chatroom.ownerpage}}"><img class="icon_m" src="{{chatroom.ownerimage}}"></a></div><div class="room-titlebox"><h2 class="room-title"><a href="/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}">{{chatroom.title}}</a></h2><div class="cat-icon"><a href="#">{{chatroom.category}}</a></div><div class="room-username"><a href="{{chatroom.ownerpage}}">by.{{chatroom.owner}}</a></div></div><div class="room-button"><a href="/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}"><input type="button" class="button_yg" value="話す"></a></div></div></div>'),e.templates.mypage.profile=Handlebars.compile('<form method="" action="" style="padding-top:20px;"><table><tr><th class="label">ニックネーム:<div class="necessity">※必須</div></th><td class="data"><input type="text" name="userName" id="userName" class="text-box" value="{{{userName}}}"><div id="error_userName" class="error"></div></td></tr><tr><th class="label">メールアドレス:<div class="necessity">※必須</div></th><td class="data"><input type="text" name="email" id="email" class="text-box" value="{{{email}}}"><div id="error_email" class="error"></div></td></tr><tr><th class="label">プロフィール:</th><td class="data"><textarea name="description" id="description" class="textarea-box">{{{description}}}</textarea><div id="error_description" class="error"></div></td></tr></table><div class="submit"><input type="button" class="button_g" id="submit_1" value="保存"></div></form>')}).call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.User=Backbone.Model.extend({id:null,userName:null,email:null,description:null,validation:{userName:[{required:!0,msg:"ニックネームを入力してください"},{rangeLength:[1,255],msg:"ニックネームは255文字以下で入力してください"}],email:[{required:!0,msg:"メールアドレスを入力してください"},{pattern:"email",msg:"メールアドレスの形式が不正です。"},{rangeLength:[3,255],msg:"メールアドレスは3文字以上255文字以下で入力してください"}],description:[]},url:"/users"}),e.Users=Backbone.Collection.extend({model:e.User,url:"/users"})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.Chatroom=Backbone.Model.extend({id:null,title1:null,title2:null,description:null,categoryId:null,userId:null,publicYN:null,validation:{categoryId:[{required:!0,msg:"カテゴリを選択してください"}],title1:[{required:!0,msg:"部屋名を入力してください"},{rangeLength:[0,100],msg:"部屋名は100文字以下で入力してください"}],title2:[{required:!0,msg:"部屋名を入力してください"},{rangeLength:[0,100],msg:"部屋名は100文字以下で入力してください"}],description:[],publicYN:[{required:!0,msg:"公開設定を選択してください"}]},url:"/chatrooms"}),e.Chatrooms=Backbone.Collection.extend({model:e.Chatroom,url:"/chatrooms",nextPage:2,parse:function(e){return this.nextPage=e.nextPage,e.chatrooms}})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.MyPageView=Backbone.View.extend({el:$("html"),events:{"click #owner-chatrooms":"getOwnerChatrooms","click #entry-chatrooms":"getEntryChatrooms","click #join-chatrooms":"getJoinChatrooms","click #edit-profile":"showProfile","click #submit_1":"editProfile","click #view-more-events":"getMore"},initialize:function(){this.model=new e.User,this.collection=new e.Chatrooms,this.mode="owner",this.token=$("#token").val(),Backbone.Validation.bind(this)},getOwnerChatrooms:function(e){this.init_list(),$("li","#owner-chatrooms").addClass("active"),this.mode="owner",this.getChatrooms()},getEntryChatrooms:function(e){this.init_list(),$("li","#entry-chatrooms").addClass("active"),this.mode="entry",this.getChatrooms()},getJoinChatrooms:function(e){this.init_list(),$("li","#join-chatrooms").addClass("active"),this.mode="join",this.getChatrooms()},getMore:function(e){var t=this.collection.nextPage;this.getChatrooms(t)},getChatrooms:function(t){var n=this;t=t||1;var r=$("html").data("profileid");$("#view-more-events").hide(),$("#view-more-loader").show(),this.collection.fetch({data:{profileId:r,mode:this.mode,page:t},success:function(t,r){var i=r.chatrooms;i&&$.each(r.chatrooms,function(t,r){var i=e.templates.mypage.list({host:$("html").data("host"),chatroom:r,isUrlOpen:n.mode==="entry"?!1:!0});$("#article_area").append(i)}),$("#view-more-loader").hide(),r.nextPage!==0&&$("#view-more-events").show()}})},showProfile:function(t){var n=$("html").data("profilename"),r=$("html").data("profileemail"),i=$("html").data("profiledescription");this.init_list(),$("li","#edit-profile").addClass("active");var s=e.templates.mypage.profile({userName:n,email:r,description:i});$("#article_area").append(s)},editProfile:function(e){e.preventDefault();var t=$("html").data("profileid"),n=$.trim($("#userName").val()),r=$.trim($("#email").val()),i=$.trim($("#description").val());this.model.set({userId:t,userName:n,email:r,description:i,isUpdate:!0}),this.model.isValid()&&this.model.save({userId:t,userName:n,email:r,description:i,token:this.token},{success:function(){location.href="/mypage"},error:function(e,t){alert(t.responseText)}}),this.model.bind("validated:invalid",function(e,t){for(key in t)$("#error_"+key).text(t[key])})},render:function(){this.getOwnerChatrooms()},init_list:function(){return $("li","#owner-chatrooms").removeClass("active"),$("li","#join-chatrooms").removeClass("active"),$("li","#edit-profile").removeClass("active"),$("#article_area").empty()}})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};$(function(){var t=new e.MyPageView;t.render(),Backbone.emulateHTTP=!0})}.call(this);
View
8 public/js/templates/mypage.js
@@ -9,17 +9,17 @@
'<div class="room">'+
'<div class="room-inbox">'+
'<div class="room-icon">'+
- '<a href="http://{{host}}{{chatroom.ownerpage}}">'+
+ '<a href="{{chatroom.ownerpage}}">'+
'<img class="icon_m" src="{{chatroom.ownerimage}}">'+
'</a>'+
'</div>'+
'<div class="room-titlebox">'+
- '<h2 class="room-title"><a href="http://{{host}}/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}">{{chatroom.title}}</a></h2>'+
+ '<h2 class="room-title"><a href="/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}">{{chatroom.title}}</a></h2>'+
'<div class="cat-icon"><a href="#">{{chatroom.category}}</a></div>'+
- '<div class="room-username"><a href="http://{{host}}{{chatroom.ownerpage}}">by.{{chatroom.owner}}</a></div>'+
+ '<div class="room-username"><a href="{{chatroom.ownerpage}}">by.{{chatroom.owner}}</a></div>'+
'</div>'+
'<div class="room-button">'+
- '<a href="http://{{host}}/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}">'+
+ '<a href="/chatrooms/{{chatroom.id}}{{#if isUrlOpen}}/open{{/if}}">'+
'<input type="button" class="button_yg" value="話す">'+
'</a>'+
'</div>'+
View
6 views/chatroom.ejs
@@ -1,6 +1,6 @@
<!DOCTYPE HTML>
<html lang="ja"
- data-host="http://<%= host %>"
+ data-host="https://<%= host %>"
data-chatroom="<%= chatroom.id %>"
data-status="<%= chatroom.status %>"
data-ownerid="<%= chatroom.ownerId %>"
@@ -73,7 +73,7 @@
<div id="content">
<div class="left-content">
-
+
<script>
$(function() {
var nav = $('.nav');
@@ -103,7 +103,7 @@
}
});
});</script>
-
+
<div class="chatroombox nav">
<div class="room-inbox">
<div class="room-icon">
View
2 views/footer.ejs
@@ -22,7 +22,7 @@
<p id="page-top"><a href="#wrap">PAGE TOP</a></p>
<div id="foot">
<footer>
- <div><a href="http://<%= config.server.host %>/terms">利用規約</a>|<a href="http://help.goo.ne.jp/" target="_blank">お問い合わせ</a></div>
+ <div><a href="/terms">利用規約</a>|<a href="http://help.goo.ne.jp/" target="_blank">お問い合わせ</a></div>
<div>copyright(C)2012 NTT Resonant inc. All Rights Reserved.</div>
</footer>
</div>
View
6 views/header.ejs
@@ -13,11 +13,11 @@ $(function() {
</script>
<div id="head">
- <header><a href="http://<%= config.server.host %>"><img src="/img/logo.png" alt="シャベリハウス"></a></header>
+ <header><a href="/"><img src="/img/logo.png" alt="シャベリハウス"></a></header>
<nav>
<ul>
- <li><a href="http://<%= config.server.host %>" >部屋を見つける</a></li>
- <li><a href="http://<%= config.server.host %>/chatrooms/new" >部屋を作る</a></li>
+ <li><a href="/" >部屋を見つける</a></li>
+ <li><a href="/chatrooms/new" >部屋を作る</a></li>
</ul>
</nav>

0 comments on commit f964c84

Please sign in to comment.
Something went wrong with that request. Please try again.