/*global app, moment, console*/ (function () { 'use strict'; var profile_type = function (level) { var level_map = { '1': '일반 유저', '2': '오픈 베타 테스터', '3': '클로즈 베타 테스터', '4': '관리자' }; return level_map[level + '']; }; var profile_from = function (provider) { var pd_map = { 'local': '직접가입', 'kakao': '카카오', 'naver': '네이버', 'google': '구글' }; return pd_map[provider + '']; }; var minimal_html = function (user) { var result = [ '
', '
', '
', '
', //이미지 '
', '
', '
닉네임: ' + user.nickname + '
', //이미지 '
이메일: ' + user.email + '
', //이메일 '
가입일: ' + moment(+new Date(user.created_at)).format('YYYY.MM.DD') + '
', '
플랜: ' + profile_type(user.plan_level) + '
', '
계정: ' + profile_from(user.provider) + '
', '
', '
' ]; return result.join(''); }; var update_user = function (user) { console.log(user); app.getdom('header_menu_opener').hide(); app.getdom('detail_section_2').hide(); app.getdom('detail_section_3').hide(); app.getdom('detail_section_banner').hide(); app.getdom('detail_section_1_title').text(user.nickname + ' 님의 프로필'); app.getdom('detail_section_1_contents').html(minimal_html(user)); app.getdom('detail_section').show(); app.events.loader_fadeout(); }; var profile_show = function () { app.getdom('header_menu_section').hide(); app.getdom('banner').hide(); app.getdom('installed_section').hide(); app.getdom('available_section').hide(); app.getdom('detail_side').hide(); app.events.loader_show(); update_user(app.memdata.user); }; var profile = { init: function () { profile_show(); var title_html = ''; title_html += ''; title_html += '프로필'; app.getdom('header_menu_title').html(title_html); } }; app.route.profile = profile; }());