From 65528fc54e2943aa259ec9129781d3fb1161ec63 Mon Sep 17 00:00:00 2001 From: Chronister Date: Mon, 29 May 2017 00:09:12 +0000 Subject: All cybrespace changes through 5/28 --- app/views/about/_links.html.haml | 2 +- app/views/about/show.html.haml | 8 ++++---- app/views/layouts/admin.html.haml | 2 +- app/views/layouts/auth.html.haml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'app/views') diff --git a/app/views/about/_links.html.haml b/app/views/about/_links.html.haml index fb3350539..d7fe317e6 100644 --- a/app/views/about/_links.html.haml +++ b/app/views/about/_links.html.haml @@ -9,4 +9,4 @@ %li= link_to t('about.get_started'), new_user_registration_path %li= link_to t('auth.login'), new_user_session_path %li= link_to t('about.terms'), terms_path - %li= link_to t('about.source_code'), 'https://github.com/tootsuite/mastodon' + %li= link_to t('about.source_code'), 'https://github.com/chronister/mastodon' diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml index d15b04163..87a729055 100644 --- a/app/views/about/show.html.haml +++ b/app/views/about/show.html.haml @@ -17,7 +17,7 @@ .wrapper %h1 - = image_tag asset_pack_path('logo.png') + = image_tag asset_pack_path('logo-cybre.png') = Setting.site_title %p!= t('about.about_mastodon') @@ -36,7 +36,7 @@ .info = link_to t('auth.login'), new_user_session_path, class: 'webapp-btn' · - = link_to t('about.other_instances'), 'https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/List-of-Mastodon-instances.md' + = link_to t('about.other_instances'), 'https://instances.mastodon.xyz/' · = link_to t('about.about_this'), about_more_path @@ -82,6 +82,6 @@ · = link_to t('about.apps'), 'https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md' · - = link_to t('about.source_code'), 'https://github.com/tootsuite/mastodon' + = link_to t('about.source_code'), 'https://github.com/chronister/mastodon' · - = link_to t('about.other_instances'), 'https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/List-of-Mastodon-instances.md' + = link_to t('about.other_instances'), 'https://instances.mastodon.xyz/' diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 59d95a0c6..b49aa83f5 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -6,7 +6,7 @@ .sidebar-wrapper .sidebar = link_to root_path do - = image_tag asset_pack_path('logo.png'), class: 'logo' + = image_tag asset_pack_path('logo-cybre.png'), class: 'logo' = render_navigation .content-wrapper diff --git a/app/views/layouts/auth.html.haml b/app/views/layouts/auth.html.haml index e5429a8ed..097fc6d08 100644 --- a/app/views/layouts/auth.html.haml +++ b/app/views/layouts/auth.html.haml @@ -6,7 +6,7 @@ .logo-container %h1 = link_to root_path do - = image_tag asset_pack_path('logo.png') + = image_tag asset_pack_path('logo-cybre.png') .form-container = render 'flashes' -- cgit From b27842dc70847cb936ae2b49777095ba12c5917b Mon Sep 17 00:00:00 2001 From: Charlotte Fields Date: Mon, 19 Jun 2017 11:23:25 +1000 Subject: cybre cleanup --- app/javascript/images/background-cybre.png | Bin 237414 -> 0 bytes app/javascript/images/logo-cybre.png | Bin 187946 -> 0 bytes .../mastodon/components/status_action_bar.js | 2 +- .../mastodon/features/getting_started/index.js | 22 ++++---- .../notifications/components/notification.js | 2 +- .../features/status/components/action_bar.js | 2 +- .../features/status/components/detailed_status.js | 2 +- app/javascript/mastodon/locales/en.json | 58 ++++++++++----------- app/javascript/styles/custom.scss | 19 ------- app/views/about/show.html.haml | 2 +- app/views/layouts/admin.html.haml | 2 +- app/views/layouts/auth.html.haml | 2 +- config/locales/en.yml | 36 ++++++------- config/locales/simple_form.en.yml | 6 +-- config/settings.yml | 2 +- public/500.html | 4 +- public/android-chrome-192x192.png | Bin 41911 -> 14344 bytes public/apple-touch-icon.png | Bin 37614 -> 4217 bytes public/emoji/1f418.png | Bin 7535 -> 1293 bytes public/emoji/1f418.svg | 18 +------ public/mstile-150x150.png | Bin 27611 -> 6916 bytes 21 files changed, 72 insertions(+), 107 deletions(-) delete mode 100644 app/javascript/images/background-cybre.png delete mode 100644 app/javascript/images/logo-cybre.png (limited to 'app/views') diff --git a/app/javascript/images/background-cybre.png b/app/javascript/images/background-cybre.png deleted file mode 100644 index 151fd5584..000000000 Binary files a/app/javascript/images/background-cybre.png and /dev/null differ diff --git a/app/javascript/images/logo-cybre.png b/app/javascript/images/logo-cybre.png deleted file mode 100644 index 41dd8fd4c..000000000 Binary files a/app/javascript/images/logo-cybre.png and /dev/null differ diff --git a/app/javascript/mastodon/components/status_action_bar.js b/app/javascript/mastodon/components/status_action_bar.js index a8ac7a70a..edb2d6eb0 100644 --- a/app/javascript/mastodon/components/status_action_bar.js +++ b/app/javascript/mastodon/components/status_action_bar.js @@ -140,7 +140,7 @@ export default class StatusActionBar extends ImmutablePureComponent {
- +
diff --git a/app/javascript/mastodon/features/getting_started/index.js b/app/javascript/mastodon/features/getting_started/index.js index c8490abe9..f8ea01024 100644 --- a/app/javascript/mastodon/features/getting_started/index.js +++ b/app/javascript/mastodon/features/getting_started/index.js @@ -10,19 +10,19 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' }, - home_timeline: { id: 'tabs_bar.home', defaultMessage: '/timelines/home' }, - notifications: { id: 'tabs_bar.notifications', defaultMessage: '~/.notifications' }, - public_timeline: { id: 'navigation_bar.public_timeline', defaultMessage: '/timelines/federated' }, + home_timeline: { id: 'tabs_bar.home', defaultMessage: 'Home' }, + notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' }, + public_timeline: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' }, navigation_subheading: { id: 'column_subheading.navigation', defaultMessage: 'Navigation' }, settings_subheading: { id: 'column_subheading.settings', defaultMessage: 'Settings' }, - community_timeline: { id: 'navigation_bar.community_timeline', defaultMessage: '/timelines/local' }, + community_timeline: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' }, preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' }, - follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: '~/.follow-requests' }, - sign_out: { id: 'navigation_bar.logout', defaultMessage: 'exit' }, - favourites: { id: 'navigation_bar.favourites', defaultMessage: '~/.florps' }, - blocks: { id: 'navigation_bar.blocks', defaultMessage: '~/.blocked' }, - mutes: { id: 'navigation_bar.mutes', defaultMessage: '~/.muted' }, - info: { id: 'navigation_bar.info', defaultMessage: '/about/more' }, + follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' }, + sign_out: { id: 'navigation_bar.logout', defaultMessage: 'Logout' }, + favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' }, + blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' }, + mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' }, + info: { id: 'navigation_bar.info', defaultMessage: 'Extended information' }, }); const mapStateToProps = state => ({ @@ -65,7 +65,7 @@ export default class GettingStarted extends ImmutablePureComponent { } navItems = navItems.concat([ - , + , ]); if (me.get('locked')) { diff --git a/app/javascript/mastodon/features/notifications/components/notification.js b/app/javascript/mastodon/features/notifications/components/notification.js index 0a4ba0214..9d631644a 100644 --- a/app/javascript/mastodon/features/notifications/components/notification.js +++ b/app/javascript/mastodon/features/notifications/components/notification.js @@ -39,7 +39,7 @@ export default class Notification extends ImmutablePureComponent {
- +
diff --git a/app/javascript/mastodon/features/status/components/action_bar.js b/app/javascript/mastodon/features/status/components/action_bar.js index 03779c2c1..29080529d 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.js +++ b/app/javascript/mastodon/features/status/components/action_bar.js @@ -82,7 +82,7 @@ export default class ActionBar extends React.PureComponent {
-
+
diff --git a/app/javascript/mastodon/features/status/components/detailed_status.js b/app/javascript/mastodon/features/status/components/detailed_status.js index 6f2415965..619957dbe 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.js +++ b/app/javascript/mastodon/features/status/components/detailed_status.js @@ -76,7 +76,7 @@ export default class DetailedStatus extends ImmutablePureComponent { · - + diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 84579f188..608d911e9 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -2,7 +2,7 @@ "account.block": "Block @{name}", "account.block_domain": "Hide everything from {domain}", "account.disclaimer": "This user is from another instance. This number may be larger.", - "account.edit_profile": "edit ~/.profile", + "account.edit_profile": "Edit profile", "account.follow": "Follow", "account.followers": "Followers", "account.follows": "Follows", @@ -10,7 +10,7 @@ "account.media": "Media", "account.mention": "Mention @{name}", "account.mute": "Mute @{name}", - "account.posts": "Pings", + "account.posts": "Posts", "account.report": "Report @{name}", "account.requested": "Awaiting approval", "account.unblock": "Unblock @{name}", @@ -18,14 +18,14 @@ "account.unfollow": "Unfollow", "account.unmute": "Unmute @{name}", "boost_modal.combo": "You can press {combo} to skip this next time", - "column.blocks": "~/.blocked", - "column.community": "/timelines/local", - "column.favourites": "~/.florps", - "column.follow_requests": "~/.follow-requests", - "column.home": "/timelines/home", - "column.mutes": "~/.muted", - "column.notifications": "~/.notifications", - "column.public": "/timelines/federated", + "column.blocks": "Blocked users", + "column.community": "Local timeline", + "column.favourites": "Favourites", + "column.follow_requests": "Follow requests", + "column.home": "Home", + "column.mutes": "Muted users", + "column.notifications": "Notifications", + "column.public": "Federated timeline", "column_back_button.label": "Back", "column_header.pin": "Pin", "column_header.unpin": "Unpin", @@ -33,9 +33,9 @@ "column_subheading.settings": "Settings", "compose_form.lock_disclaimer": "Your account is not {locked}. Anyone can follow you to view your follower-only posts.", "compose_form.lock_disclaimer.lock": "locked", - "compose_form.placeholder": "What is in your databanks?", + "compose_form.placeholder": "What is on your mind?", "compose_form.privacy_disclaimer": "Your post will be delivered to mentioned users on {domains}. Do you trust {domainsCount, plural, one {that server} other {those servers}}? Post privacy only works on Mastodon instances. If {domains} {domainsCount, plural, one {is not a Mastodon instance} other {are not Mastodon instances}}, there will be no indication that your post is not a public post, and it may be boosted or otherwise made visible to unintended recipients.", - "compose_form.publish": "Ping", + "compose_form.publish": "Toot", "compose_form.publish_loud": "{publish}!", "compose_form.sensitive": "Mark media as sensitive", "compose_form.spoiler": "Hide text behind warning", @@ -61,7 +61,7 @@ "emoji_button.travel": "Travel & Places", "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", "empty_column.hashtag": "There is nothing in this hashtag yet.", - "empty_column.home": "You aren't following anyone yet. Visit {public} or use query to get started and meet other users.", + "empty_column.home": "You aren't following anyone yet. Visit {public} or use search to get started and meet other users.", "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "the public timeline", "empty_column.notifications": "You don't have any notifications yet. Interact with others to start the conversation.", @@ -76,24 +76,24 @@ "home.column_settings.advanced": "Advanced", "home.column_settings.basic": "Basic", "home.column_settings.filter_regex": "Filter out by regular expressions", - "home.column_settings.show_reblogs": "Show relays", + "home.column_settings.show_reblogs": "Show boosts", "home.column_settings.show_replies": "Show replies", "home.settings": "Column settings", "lightbox.close": "Close", "loading_indicator.label": "Loading...", "media_gallery.toggle_visible": "Toggle visibility", "missing_indicator.label": "Not found", - "navigation_bar.blocks": "~/.blocks", - "navigation_bar.community_timeline": "/timelines/local", - "navigation_bar.edit_profile": "edit ~/.profile", - "navigation_bar.favourites": "~/.florps", - "navigation_bar.follow_requests": "~/.follow-requests", - "navigation_bar.info": "/about/more", - "navigation_bar.logout": "Jack out", - "navigation_bar.mutes": "~/.muted", + "navigation_bar.blocks": "Blocked users", + "navigation_bar.community_timeline": "Local timeline", + "navigation_bar.edit_profile": "Edit profile", + "navigation_bar.favourites": "Favourites", + "navigation_bar.follow_requests": "Follow requests", + "navigation_bar.info": "About this instance", + "navigation_bar.logout": "Logout", + "navigation_bar.mutes": "Muted users", "navigation_bar.preferences": "Preferences", - "navigation_bar.public_timeline": "/timelines/federated", - "notification.favourite": "{name} florped your ping", + "navigation_bar.public_timeline": "Federated timeline", + "notification.favourite": "{name} favourited your status", "notification.follow": "{name} followed you", "notification.mention": "{name} mentioned you", "notification.reblog": "{name} boosted your status", @@ -140,18 +140,18 @@ "report.placeholder": "Additional comments", "report.submit": "Submit", "report.target": "Reporting", - "search.placeholder": "Query...", + "search.placeholder": "Search", "search_results.total": "{count, number} {count, plural, one {result} other {results}}", - "status.cannot_reblog": "This ping cannot be relayed", + "status.cannot_reblog": "This post cannot be boosted", "status.delete": "Delete", - "status.favourite": "Florp", + "status.favourite": "Favourite", "status.load_more": "Load more", "status.media_hidden": "Media hidden", "status.mention": "Mention @{name}", "status.mute_conversation": "Mute conversation", "status.open": "Expand this status", - "status.reblog": "Relay", - "status.reblogged_by": "{name} relayed", + "status.reblog": "Boost", + "status.reblogged_by": "{name} boosted", "status.reply": "Reply", "status.replyAll": "Reply to thread", "status.report": "Report @{name}", diff --git a/app/javascript/styles/custom.scss b/app/javascript/styles/custom.scss index 8c6c12316..5bfe2a412 100644 --- a/app/javascript/styles/custom.scss +++ b/app/javascript/styles/custom.scss @@ -1,14 +1,5 @@ -$ui-base-color: #181818; // darkest -$ui-secondary-color: #dae8da; // lightest -$ui-primary-color: #dae8da; // lighter -$ui-highlight-color: #1ea21e; // vibrant - @import 'application'; -body { - background: $ui-base-color url('../images/background-cybre.png'); -} - @media screen and (min-width: 1300px) { .column { flex-grow: 1 !important; @@ -59,16 +50,6 @@ body { .screenshot-with-signup .closed-registrations-message .clock { font-size:150%; -} - -.column .static-content.getting-started { - background-image: url('../images/logo-cybre.png'), url('../images/background-cybre.png'); - background-position: 50% 50%; - background-size:cover; -} - -.columns-area { - background: $ui-base-color url('../images/background-cybre.png'); } .drawer .drawer__inner { diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml index 87a729055..2a7f8c752 100644 --- a/app/views/about/show.html.haml +++ b/app/views/about/show.html.haml @@ -17,7 +17,7 @@ .wrapper %h1 - = image_tag asset_pack_path('logo-cybre.png') + = image_tag asset_pack_path('logo.png') = Setting.site_title %p!= t('about.about_mastodon') diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index b49aa83f5..59d95a0c6 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -6,7 +6,7 @@ .sidebar-wrapper .sidebar = link_to root_path do - = image_tag asset_pack_path('logo-cybre.png'), class: 'logo' + = image_tag asset_pack_path('logo.png'), class: 'logo' = render_navigation .content-wrapper diff --git a/app/views/layouts/auth.html.haml b/app/views/layouts/auth.html.haml index 097fc6d08..e5429a8ed 100644 --- a/app/views/layouts/auth.html.haml +++ b/app/views/layouts/auth.html.haml @@ -6,7 +6,7 @@ .logo-container %h1 = link_to root_path do - = image_tag asset_pack_path('logo-cybre.png') + = image_tag asset_pack_path('logo.png') .form-container = render 'flashes' diff --git a/config/locales/en.yml b/config/locales/en.yml index 201651d17..0d33aae3f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,30 +1,30 @@ --- en: about: - about_mastodon: Cybrespace is an instance of Mastodon, a free, open-source social network. A decentralized alternative to commercial platforms, it avoids the risks of a single company monopolizing your communication. Pick a server that you trust — whichever you choose, you can interact with everyone else. Anyone can run their own Mastodon instance and participate in the social network seamlessly. + about_mastodon: Mastodon is a free, open-source social network. A decentralized alternative to commercial platforms, it avoids the risks of a single company monopolizing your communication. Pick a server that you trust — whichever you choose, you can interact with everyone else. Anyone can run their own Mastodon instance and participate in the social network seamlessly. about_this: About this instance apps: Apps business_email: 'Business e-mail:' closed_registrations: Registrations are currently closed on this instance. contact: Contact - description_headline: What's special about %{domain}? + description_headline: What is %{domain}? domain_count_after: other instances domain_count_before: Connected to features: api: Open API for apps and services blocks: Rich block and muting tools - characters: 512 characters per post + characters: 500 characters per post chronology: Timelines are chronological ethics: 'Ethical design: no ads, no tracking' gifv: GIFV sets and short videos - privacy: Granular, per-ping privacy settings + privacy: Granular, per-post privacy settings public: Public timelines features_headline: What sets Mastodon apart get_started: Get started links: Links other_instances: Other instances source_code: Source code - status_count_after: pings + status_count_after: statuses status_count_before: Who authored terms: Terms user_count_after: users @@ -37,7 +37,7 @@ en: nothing_here: There is nothing here! people_followed_by: People whom %{name} follows people_who_follow: People who follow %{name} - posts: Pings + posts: Posts remote_follow: Remote follow reserved_username: The username is reserved unfollow: Unfollow @@ -205,9 +205,9 @@ en: delete_account_html: If you wish to delete your account, you can proceed here. You will be asked for confirmation. didnt_get_confirmation: Didn't receive confirmation instructions? forgot_password: Forgot your password? - login: Jack in - logout: Jack out - register: Apply for upload + login: Log in + logout: Logout + register: Sign up resend_confirmation: Resend confirmation instructions reset_password: Reset password set_new_password: Set new password @@ -255,7 +255,7 @@ en: storage: Media storage followers: domain: Domain - explanation_html: If you want to ensure the privacy of your pings , you must be aware of who is following you. Your private pings are delivered to all instances where you have followers. You may wish to review them, and remove followers if you do not trust your privacy to be respected by the staff or software of those instances. + explanation_html: If you want to ensure the privacy of your statuses, you must be aware of who is following you. Your private statuses are delivered to all instances where you have followers. You may wish to review them, and remove followers if you do not trust your privacy to be respected by the staff or software of those instances. followers_count: Number of followers lock_link: Lock your account purge: Remove from followers @@ -263,7 +263,7 @@ en: one: In the process of soft-blocking followers from one domain... other: In the process of soft-blocking followers from %{count} domains... true_privacy_html: Please mind that true privacy can only be achieved with end-to-end encryption. - unlocked_warning_html: Anyone can follow you to immediately view your private pings. %{lock_link} to be able to review and reject followers. + unlocked_warning_html: Anyone can follow you to immediately view your private statuses. %{lock_link} to be able to review and reject followers. unlocked_warning_title: Your account is not locked generic: changes_saved_msg: Changes successfully saved! @@ -284,7 +284,7 @@ en: landing_strip_signup_html: If you don't, you can sign up here. media_attachments: validations: - images_and_video: Cannot attach a video to a ping that already contains images + images_and_video: Cannot attach a video to a status that already contains images too_many: Cannot attach more than 4 files notification_mailer: digest: @@ -297,8 +297,8 @@ en: one: "1 new notification since your last visit \U0001F418" other: "%{count} new notifications since your last visit \U0001F418" favourite: - body: 'Your ping was florped by %{name}:' - subject: "%{name} florped your ping" + body: 'Your status was favourited by %{name}:' + subject: "%{name} favourited your status" follow: body: "%{name} is now following you!" subject: "%{name} is now following you" @@ -309,8 +309,8 @@ en: body: 'You were mentioned by %{name} in:' subject: You were mentioned by %{name} reblog: - body: 'Your ping was relayed by %{name}:' - subject: "%{name} relayed your ping" + body: 'Your status was boosted by %{name}:' + subject: "%{name} boosted your status" pagination: next: Next prev: Prev @@ -324,7 +324,7 @@ en: authorized_apps: Authorized apps back: Back to Mastodon delete: Account deletion - edit_profile: edit ~/.profile + edit_profile: Edit profile export: Data export followers: Authorized followers import: Import @@ -344,7 +344,7 @@ en: unlisted_long: Everyone can see, but not listed on public timelines stream_entries: click_to_show: Click to show - reblogged: relayed + reblogged: boosted sensitive_content: Sensitive content time: formats: diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 99173e948..3e769fb96 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -8,7 +8,7 @@ en: one: 1 character left other: %{count} characters left header: PNG, GIF or JPG. At most 2MB. Will be downscaled to 700x335px - locked: Requires you to manually approve followers and defaults ping privacy to followers-only + locked: Requires you to manually approve followers and defaults post privacy to followers-only note: one: 1 character left other: %{count} characters left @@ -46,11 +46,11 @@ en: must_be_following: Block notifications from people you don't follow notification_emails: digest: Send digest e-mails - favourite: Send e-mail when someone florps your ping + favourite: Send e-mail when someone favourites your status follow: Send e-mail when someone follows you follow_request: Send e-mail when someone requests to follow you mention: Send e-mail when someone mentions you - reblog: Send e-mail when someone boosts your ping + reblog: Send e-mail when someone boosts your status 'no': 'No' required: mark: "*" diff --git a/config/settings.yml b/config/settings.yml index 13ac097c6..19d2ca7be 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -7,7 +7,7 @@ # For more information, see docs/Running-Mastodon/Administration-guide.md # defaults: &defaults - site_title: 'Cybrespace' + site_title: 'dev.glitch.social' site_description: '' site_extended_description: '' site_contact_username: '' diff --git a/public/500.html b/public/500.html index 4197f5cdd..5812bb476 100644 --- a/public/500.html +++ b/public/500.html @@ -8,7 +8,7 @@ - - 1f418 - - - - + \ No newline at end of file diff --git a/public/mstile-150x150.png b/public/mstile-150x150.png index a79f11992..57eae8355 100644 Binary files a/public/mstile-150x150.png and b/public/mstile-150x150.png differ -- cgit From c0a665865e5f06f45296e76bfef3790f8149b0ee Mon Sep 17 00:00:00 2001 From: beatrix-bitrot Date: Tue, 16 May 2017 02:25:53 +0000 Subject: update bio length to 500 --- app/javascript/packs/public.js | 2 +- app/models/account.rb | 2 +- app/views/settings/profiles/show.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app/views') diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index a0e511b0a..150a60670 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -87,7 +87,7 @@ function main() { delegate(document, '.account_note', 'input', ({ target }) => { const noteCounter = document.querySelector('.note-counter'); if (noteCounter) { - noteCounter.textContent = 160 - length(target.value); + noteCounter.textContent = 500 - length(target.value); } }); } diff --git a/app/models/account.rb b/app/models/account.rb index 2b54cee5f..14c90cfc0 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -60,7 +60,7 @@ class Account < ApplicationRecord validates :username, format: { with: /\A[a-z0-9_]+\z/i }, uniqueness: { scope: :domain, case_sensitive: false }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? } validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? } validates :display_name, length: { maximum: 30 }, if: -> { local? && will_save_change_to_display_name? } - validates :note, length: { maximum: 160 }, if: -> { local? && will_save_change_to_note? } + validates :note, length: { maximum: 500 }, if: -> { local? && will_save_change_to_note? } # Timelines has_many :stream_entries, inverse_of: :account, dependent: :destroy diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml index 2b846006f..8dc61fec9 100644 --- a/app/views/settings/profiles/show.html.haml +++ b/app/views/settings/profiles/show.html.haml @@ -6,7 +6,7 @@ .fields-group = f.input :display_name, placeholder: t('simple_form.labels.defaults.display_name'), hint: t('simple_form.hints.defaults.display_name', count: 30 - @account.display_name.size).html_safe - = f.input :note, placeholder: t('simple_form.labels.defaults.note'), hint: t('simple_form.hints.defaults.note', count: 160 - @account.note.size).html_safe + = f.input :note, placeholder: t('simple_form.labels.defaults.note'), hint: t('simple_form.hints.defaults.note', count: 500 - @account.note.size).html_safe = f.input :avatar, wrapper: :with_label, input_html: { accept: AccountAvatar::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.avatar') = f.input :header, wrapper: :with_label, input_html: { accept: AccountHeader::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.header') -- cgit From 6107e954040443d1fc4344b440b229d70fe75166 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Wed, 28 Jun 2017 00:27:44 -0700 Subject: Backend YAML Processing + Profile Metadata on Static Pages --- app/javascript/styles/accounts.scss | 133 ++++++++++--------- app/lib/frontmatter_handler.rb | 242 +++++++++++++++++++++++++++++++++++ app/views/accounts/_header.html.haml | 45 ++++--- 3 files changed, 337 insertions(+), 83 deletions(-) create mode 100644 app/lib/frontmatter_handler.rb (limited to 'app/views') diff --git a/app/javascript/styles/accounts.scss b/app/javascript/styles/accounts.scss index 10f8bd2b9..d346a6bb2 100644 --- a/app/javascript/styles/accounts.scss +++ b/app/javascript/styles/accounts.scss @@ -1,29 +1,34 @@ .card { + display: flex; background: $ui-base-color; - background-size: cover; - background-position: center; - padding: 60px 0; - padding-bottom: 0; border-radius: 4px 4px 0 0; box-shadow: 0 0 15px rgba($base-shadow-color, 0.2); overflow: hidden; - position: relative; @media screen and (max-width: 700px) { border-radius: 0; box-shadow: none; } - &::after { - background: linear-gradient(rgba($base-shadow-color, 0.5), rgba($base-shadow-color, 0.8)); - display: block; - content: ""; - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - z-index: 1; + .details { + position: relative; + padding: 60px 0 0; + background-size: cover; + background-position: center; + text-align: center; + flex: auto; + + &::after { + background: linear-gradient(rgba($base-shadow-color, 0.5), rgba($base-shadow-color, 0.8)); + display: block; + content: ""; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + z-index: 1; + } } .name { @@ -66,57 +71,36 @@ z-index: 2; } - .details { - display: flex; - margin-top: 30px; - position: relative; - z-index: 2; - flex-direction: row; - } - .details-counters { - display: flex; + position: relative; + display: inline-flex; flex-direction: row; - order: 0; + margin: 15px 0; + z-index: 2; } .counter { width: 80px; color: $ui-primary-color; padding: 5px 10px 0; - margin-bottom: 10px; - border-right: 1px solid $ui-primary-color; cursor: default; position: relative; - a { - display: block; + & + .counter { + border-left: 1px solid $ui-primary-color; } - &::after { - display: block; - content: ""; - position: absolute; - bottom: -10px; - left: 0; - width: 100%; - border-bottom: 4px solid $ui-primary-color; - opacity: 0.5; - transition: all 0.8s ease; + & > * { + opacity: .7; + transition: opacity .3s ease; } - &.active { - &::after { - border-bottom: 4px solid $ui-highlight-color; - opacity: 1; - } + &.active > *, &:hover > * { + opacity: 1; } - &:hover { - &::after { - opacity: 1; - transition-duration: 0.2s; - } + a { + display: block; } a { @@ -140,30 +124,51 @@ } .bio { - flex: 1; + position: relative; font-size: 14px; line-height: 18px; + margin: 15px 0; padding: 5px 10px; color: $ui-secondary-color; - order: 1; + z-index: 2; } - @media screen and (max-width: 480px) { - .details { - display: block; - } + .metadata { + max-width: 40%; + background: $ui-base-color; + color: $primary-text-color; + text-align: left; + overflow-y: auto; + white-space: pre-wrap; - .bio { - text-align: center; - margin-bottom: 20px; - } + .metadata-item { + border-bottom: 1px $ui-primary-color solid; + padding: 15px 10px; + font-size: 18px; + line-height: 24px; + overflow: hidden; + text-overflow: ellipsis; - .counter { - flex: 1 1 auto; - } + a { + color: $ui-highlight-color; + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } - .counter:last-child { - border-right: none; + b { + display: block; + font-size: 12px; + line-height: 16px; + text-transform: uppercase; + color: $ui-primary-color; + + a { + color: $ui-primary-color; + } + } } } } diff --git a/app/lib/frontmatter_handler.rb b/app/lib/frontmatter_handler.rb new file mode 100644 index 000000000..19007cf4e --- /dev/null +++ b/app/lib/frontmatter_handler.rb @@ -0,0 +1,242 @@ +# frozen_string_literal: true + +require 'singleton' + +# See also `app/javascript/features/account/util/bio_metadata.js`. + +class FrontmatterHandler + include Singleton + + # CONVENIENCE FUNCTIONS # + + def self.unirex(str) + Regexp.new str, false, 'um' + end + def self.rexstr(exp) + '(?:' + exp.source + ')' + end + + # CHARACTER CLASSES # + + DOCUMENT_START = /^/ + DOCUMENT_END = /$/ + ALLOWED_CHAR = # c-printable` in the YAML 1.2 spec. + /[\t\n\r\u{20}-\u{7e}\u{85}\u{a0}-\u{d7ff}\u{e000}-\u{fffd}\u{10000}-\u{10ffff}]/u + WHITE_SPACE = /[ \t]/ + INDENTATION = / */ + LINE_BREAK = /\r?\n|\r|/ + ESCAPE_CHAR = /[0abt\tnvfre "\/\\N_LP]/ + HEXADECIMAL_CHARS = /[0-9a-fA-F]/ + INDICATOR = /[-?:,\[\]{}&#*!|>'"%@`]/ + FLOW_CHAR = /[,\[\]{}]/ + + # NEGATED CHARACTER CLASSES # + + NOT_WHITE_SPACE = unirex '(?!' + rexstr(WHITE_SPACE) + ').' + NOT_LINE_BREAK = unirex '(?!' + rexstr(LINE_BREAK) + ').' + NOT_INDICATOR = unirex '(?!' + rexstr(INDICATOR) + ').' + NOT_FLOW_CHAR = unirex '(?!' + rexstr(FLOW_CHAR) + ').' + + # BASIC CONSTRUCTS # + + ANY_WHITE_SPACE = unirex rexstr(WHITE_SPACE) + '*' + ANY_ALLOWED_CHARS = unirex rexstr(ALLOWED_CHAR) + '*' + NEW_LINE = unirex( + rexstr(ANY_WHITE_SPACE) + rexstr(LINE_BREAK) + ) + SOME_NEW_LINES = unirex( + '(?:' + rexstr(ANY_WHITE_SPACE) + rexstr(LINE_BREAK) + ')+' + ) + POSSIBLE_STARTS = unirex( + rexstr(DOCUMENT_START) + rexstr(/]*>/) + '?' + ) + POSSIBLE_ENDS = unirex( + rexstr(SOME_NEW_LINES) + '|' + + rexstr(DOCUMENT_END) + '|' + + rexstr(/<\/p>/) + ) + CHARACTER_ESCAPE = unirex( + rexstr(/\\/) + + '(?:' + + rexstr(ESCAPE_CHAR) + '|' + + rexstr(/x/) + rexstr(HEXADECIMAL_CHARS) + '{2}' + '|' + + rexstr(/u/) + rexstr(HEXADECIMAL_CHARS) + '{4}' + '|' + + rexstr(/U/) + rexstr(HEXADECIMAL_CHARS) + '{8}' + + ')' + ) + ESCAPED_CHAR = unirex( + rexstr(/(?!["\\])/) + rexstr(NOT_LINE_BREAK) + '|' + + rexstr(CHARACTER_ESCAPE) + ) + ANY_ESCAPED_CHARS = unirex( + rexstr(ESCAPED_CHAR) + '*' + ) + ESCAPED_APOS = unirex( + '(?=' + rexstr(NOT_LINE_BREAK) + ')' + rexstr(/[^']|''/) + ) + ANY_ESCAPED_APOS = unirex( + rexstr(ESCAPED_APOS) + '*' + ) + FIRST_KEY_CHAR = unirex( + '(?=' + rexstr(NOT_LINE_BREAK) + ')' + + '(?=' + rexstr(NOT_WHITE_SPACE) + ')' + + rexstr(NOT_INDICATOR) + '|' + + rexstr(/[?:-]/) + + '(?=' + rexstr(NOT_LINE_BREAK) + ')' + + '(?=' + rexstr(NOT_WHITE_SPACE) + ')' + + '(?=' + rexstr(NOT_FLOW_CHAR) + ')' + ) + FIRST_VALUE_CHAR = unirex( + '(?=' + rexstr(NOT_LINE_BREAK) + ')' + + '(?=' + rexstr(NOT_WHITE_SPACE) + ')' + + rexstr(NOT_INDICATOR) + '|' + + rexstr(/[?:-]/) + + '(?=' + rexstr(NOT_LINE_BREAK) + ')' + + '(?=' + rexstr(NOT_WHITE_SPACE) + ')' + # Flow indicators are allowed in values. + ) + LATER_KEY_CHAR = unirex( + rexstr(WHITE_SPACE) + '|' + + '(?=' + rexstr(NOT_LINE_BREAK) + ')' + + '(?=' + rexstr(NOT_WHITE_SPACE) + ')' + + '(?=' + rexstr(NOT_FLOW_CHAR) + ')' + + rexstr(/[^:#]#?/) + '|' + + rexstr(/:/) + '(?=' + rexstr(NOT_WHITE_SPACE) + ')' + ) + LATER_VALUE_CHAR = unirex( + rexstr(WHITE_SPACE) + '|' + + '(?=' + rexstr(NOT_LINE_BREAK) + ')' + + '(?=' + rexstr(NOT_WHITE_SPACE) + ')' + + # Flow indicators are allowed in values. + rexstr(/[^:#]#?/) + '|' + + rexstr(/:/) + '(?=' + rexstr(NOT_WHITE_SPACE) + ')' + ) + + # YAML CONSTRUCTS # + + YAML_START = unirex( + rexstr(ANY_WHITE_SPACE) + rexstr(/---/) + ) + YAML_END = unirex( + rexstr(ANY_WHITE_SPACE) + rexstr(/(?:---|\.\.\.)/) + ) + YAML_LOOKAHEAD = unirex( + '(?=' + + rexstr(YAML_START) + + rexstr(ANY_ALLOWED_CHARS) + rexstr(NEW_LINE) + + rexstr(YAML_END) + rexstr(POSSIBLE_ENDS) + + ')' + ) + YAML_DOUBLE_QUOTE = unirex( + rexstr(/"/) + rexstr(ANY_ESCAPED_CHARS) + rexstr(/"/) + ) + YAML_SINGLE_QUOTE = unirex( + rexstr(/'/) + rexstr(ANY_ESCAPED_APOS) + rexstr(/'/) + ) + YAML_SIMPLE_KEY = unirex( + rexstr(FIRST_KEY_CHAR) + rexstr(LATER_KEY_CHAR) + '*' + ) + YAML_SIMPLE_VALUE = unirex( + rexstr(FIRST_VALUE_CHAR) + rexstr(LATER_VALUE_CHAR) + '*' + ) + YAML_KEY = unirex( + rexstr(YAML_DOUBLE_QUOTE) + '|' + + rexstr(YAML_SINGLE_QUOTE) + '|' + + rexstr(YAML_SIMPLE_KEY) + ) + YAML_VALUE = unirex( + rexstr(YAML_DOUBLE_QUOTE) + '|' + + rexstr(YAML_SINGLE_QUOTE) + '|' + + rexstr(YAML_SIMPLE_VALUE) + ) + YAML_SEPARATOR = unirex( + rexstr(ANY_WHITE_SPACE) + + ':' + rexstr(WHITE_SPACE) + + rexstr(ANY_WHITE_SPACE) + ) + YAML_LINE = unirex( + '(' + rexstr(YAML_KEY) + ')' + + rexstr(YAML_SEPARATOR) + + '(' + rexstr(YAML_VALUE) + ')' + ) + + # FRONTMATTER REGEX # + + YAML_FRONTMATTER = unirex( + rexstr(POSSIBLE_STARTS) + + rexstr(YAML_LOOKAHEAD) + + rexstr(YAML_START) + rexstr(SOME_NEW_LINES) + + '(?:' + + '(' + rexstr(INDENTATION) + ')' + + rexstr(YAML_LINE) + rexstr(SOME_NEW_LINES) + + '(?:' + + '\\1' + rexstr(YAML_LINE) + rexstr(SOME_NEW_LINES) + + '){0,4}' + + ')?' + + rexstr(YAML_END) + rexstr(POSSIBLE_ENDS) + ) + + # SEARCHES # + + FIND_YAML_LINES = unirex( + rexstr(NEW_LINE) + rexstr(INDENTATION) + rexstr(YAML_LINE) + ) + + # STRING PROCESSING # + + def process_string(str) + case str[0] + when '"' + str[1..-2] + .gsub(/\\0/, "\u{00}") + .gsub(/\\a/, "\u{07}") + .gsub(/\\b/, "\u{08}") + .gsub(/\\t/, "\u{09}") + .gsub(/\\n/, "\u{0a}") + .gsub(/\\v/, "\u{0b}") + .gsub(/\\f/, "\u{0c}") + .gsub(/\\r/, "\u{0d}") + .gsub(/\\e/, "\u{1b}") + .gsub(/\\ /, "\u{20}") + .gsub(/\\"/, "\u{22}") + .gsub(/\\\//, "\u{2f}") + .gsub(/\\\\/, "\u{5c}") + .gsub(/\\N/, "\u{85}") + .gsub(/\\_/, "\u{a0}") + .gsub(/\\L/, "\u{2028}") + .gsub(/\\P/, "\u{2029}") + .gsub(/\\x([0-9a-fA-F]{2})/mu) {|s| $1.to_i.chr Encoding::UTF_8} + .gsub(/\\u([0-9a-fA-F]{4})/mu) {|s| $1.to_i.chr Encoding::UTF_8} + .gsub(/\\U([0-9a-fA-F]{8})/mu) {|s| $1.to_i.chr Encoding::UTF_8} + when "'" + str[1..-2].gsub(/''/, "'") + else + str + end + end + + # BIO PROCESSING # + + def process_bio content + result = { + text: content.gsub(/"/, '"').gsub(/'/, "'"), + metadata: [] + } + yaml = YAML_FRONTMATTER.match(result[:text]) + return result unless yaml + yaml = yaml[0] + start = YAML_START =~ result[:text] + ending = start + yaml.length - (YAML_START =~ yaml) + result[:text][start..ending - 1] = '' + metadata = nil + index = 0 + while metadata = FIND_YAML_LINES.match(yaml, index) do + index = metadata.end(0) + result[:metadata].push [ + process_string(metadata[1]), process_string(metadata[2]) + ] + end + return result + end + +end diff --git a/app/views/accounts/_header.html.haml b/app/views/accounts/_header.html.haml index 6451a5573..ef6a2bcbe 100644 --- a/app/views/accounts/_header.html.haml +++ b/app/views/accounts/_header.html.haml @@ -1,23 +1,24 @@ -.card.h-card.p-author{ style: "background-image: url(#{account.header.url(:original)})" } - - if user_signed_in? && current_account.id != account.id && !current_account.requested?(account) - .controls - - if current_account.following?(account) - = link_to t('accounts.unfollow'), account_unfollow_path(account), data: { method: :post }, class: 'button' - - else - = link_to t('accounts.follow'), account_follow_path(account), data: { method: :post }, class: 'button' - - elsif !user_signed_in? - .controls - .remote-follow - = link_to t('accounts.remote_follow'), account_remote_follow_path(account), class: 'button' - .avatar= image_tag account.avatar.url(:original), class: 'u-photo' - %h1.name - %span.p-name.emojify= display_name(account) - %small - %span @#{account.username} - = fa_icon('lock') if account.locked? - .details +- processed_bio = FrontmatterHandler.instance.process_bio Formatter.instance.simplified_format account +.card.h-card.p-author + .details{ style: "background-image: url(#{account.header.url(:original)})" } + - if user_signed_in? && current_account.id != account.id && !current_account.requested?(account) + .controls + - if current_account.following?(account) + = link_to t('accounts.unfollow'), account_unfollow_path(account), data: { method: :post }, class: 'button' + - else + = link_to t('accounts.follow'), account_follow_path(account), data: { method: :post }, class: 'button' + - elsif !user_signed_in? + .controls + .remote-follow + = link_to t('accounts.remote_follow'), account_remote_follow_path(account), class: 'button' + .avatar= image_tag account.avatar.url(:original), class: 'u-photo' + %h1.name + %span.p-name.emojify= display_name(account) + %small + %span @#{account.username} + = fa_icon('lock') if account.locked? .bio - .account__header__content.p-note.emojify= Formatter.instance.simplified_format(account) + .account__header__content.p-note.emojify!=processed_bio[:text] .details-counters .counter{ class: active_nav_class(short_account_url(account)) } @@ -32,3 +33,9 @@ = link_to account_followers_url(account) do %span.counter-label= t('accounts.followers') %span.counter-number= number_with_delimiter account.followers_count + - if processed_bio[:metadata].length > 0 + .metadata< + - processed_bio[:metadata].each do |i| + .metadata-item>< + %b.emojify>!=i[0] + %span.emojify>!=i[1] -- cgit From 03f964837707cdb01c32d182a68a74a13848c92a Mon Sep 17 00:00:00 2001 From: kibigo! Date: Wed, 28 Jun 2017 00:57:32 -0700 Subject: Improvements to static metadata styling, especially for mobile --- app/javascript/styles/accounts.scss | 62 +++++++++++++++++++++++------------- app/views/accounts/_header.html.haml | 4 +-- 2 files changed, 41 insertions(+), 25 deletions(-) (limited to 'app/views') diff --git a/app/javascript/styles/accounts.scss b/app/javascript/styles/accounts.scss index d346a6bb2..c9caa64bf 100644 --- a/app/javascript/styles/accounts.scss +++ b/app/javascript/styles/accounts.scss @@ -1,10 +1,25 @@ .card { display: flex; + position: relative; background: $ui-base-color; + background-size: cover; + background-position: center; border-radius: 4px 4px 0 0; box-shadow: 0 0 15px rgba($base-shadow-color, 0.2); overflow: hidden; + &::after { + background: linear-gradient(rgba($base-shadow-color, 0.5), rgba($base-shadow-color, 0.8)); + display: block; + content: ""; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + z-index: 1; + } + @media screen and (max-width: 700px) { border-radius: 0; box-shadow: none; @@ -13,22 +28,9 @@ .details { position: relative; padding: 60px 0 0; - background-size: cover; - background-position: center; text-align: center; flex: auto; - - &::after { - background: linear-gradient(rgba($base-shadow-color, 0.5), rgba($base-shadow-color, 0.8)); - display: block; - content: ""; - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - z-index: 1; - } + z-index: 2; } .name { @@ -38,8 +40,6 @@ color: $primary-text-color; font-weight: 500; text-align: center; - position: relative; - z-index: 2; text-shadow: 0 0 2px $base-shadow-color; small { @@ -54,8 +54,6 @@ @include avatar-size(120px); margin: 0 auto; margin-bottom: 15px; - position: relative; - z-index: 2; img { @include avatar-radius(); @@ -72,11 +70,9 @@ } .details-counters { - position: relative; display: inline-flex; flex-direction: row; margin: 15px 0; - z-index: 2; } .counter { @@ -124,22 +120,23 @@ } .bio { - position: relative; font-size: 14px; line-height: 18px; margin: 15px 0; padding: 5px 10px; color: $ui-secondary-color; - z-index: 2; } .metadata { + position: relative; + min-width: 180px; max-width: 40%; - background: $ui-base-color; + background: rgba($base-shadow-color, 0.8); color: $primary-text-color; text-align: left; overflow-y: auto; white-space: pre-wrap; + z-index: 3; .metadata-item { border-bottom: 1px $ui-primary-color solid; @@ -173,6 +170,25 @@ } } + + +@media screen and (max-width: 500px) { + + .card { + display: block; + + .metadata { + max-width: none; + background: $base-shadow-color; + border-top: 1px $ui-primary-color solid; + + .metadata-item { + padding: 15px 20px; + } + } + } +} + .pagination { padding: 30px 0; text-align: center; diff --git a/app/views/accounts/_header.html.haml b/app/views/accounts/_header.html.haml index ef6a2bcbe..ed8a6f091 100644 --- a/app/views/accounts/_header.html.haml +++ b/app/views/accounts/_header.html.haml @@ -1,6 +1,6 @@ - processed_bio = FrontmatterHandler.instance.process_bio Formatter.instance.simplified_format account -.card.h-card.p-author - .details{ style: "background-image: url(#{account.header.url(:original)})" } +.card.h-card.p-author{ style: "background-image: url(#{account.header.url(:original)})" } + .details - if user_signed_in? && current_account.id != account.id && !current_account.requested?(account) .controls - if current_account.following?(account) -- cgit From fc65b691df3c1a0a9635ae337fd163c5336f87ce Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 29 Jun 2017 22:59:28 -0700 Subject: Images now behind CWs on static pages --- .../stream_entries/_content_spoiler.html.haml | 2 +- .../stream_entries/_detailed_status.html.haml | 29 ++++++++++---------- app/views/stream_entries/_media.html.haml | 2 +- app/views/stream_entries/_simple_status.html.haml | 31 +++++++++++----------- 4 files changed, 33 insertions(+), 31 deletions(-) (limited to 'app/views') diff --git a/app/views/stream_entries/_content_spoiler.html.haml b/app/views/stream_entries/_content_spoiler.html.haml index d80ea46a0..0bd6314d0 100644 --- a/app/views/stream_entries/_content_spoiler.html.haml +++ b/app/views/stream_entries/_content_spoiler.html.haml @@ -1,3 +1,3 @@ -.media-spoiler +.media-spoiler>< %span= t('stream_entries.sensitive_content') %span= t('stream_entries.click_to_show') diff --git a/app/views/stream_entries/_detailed_status.html.haml b/app/views/stream_entries/_detailed_status.html.haml index ef60b9925..589d647ce 100644 --- a/app/views/stream_entries/_detailed_status.html.haml +++ b/app/views/stream_entries/_detailed_status.html.haml @@ -12,21 +12,22 @@ %p{ style: 'margin-bottom: 0' }< %span.p-summary> #{status.spoiler_text}  %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more') - .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status) + .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }< + = Formatter.instance.format(status) - - unless status.media_attachments.empty? - - if status.media_attachments.first.video? - .video-player - - if status.sensitive? - = render partial: 'stream_entries/content_spoiler' - %video.u-video{ src: status.media_attachments.first.file.url(:original), loop: true } - - else - .detailed-status__attachments - - if status.sensitive? - = render partial: 'stream_entries/content_spoiler' - .status__attachments__inner - - status.media_attachments.each do |media| - = render partial: 'stream_entries/media', locals: { media: media } + - unless status.media_attachments.empty? + - if status.media_attachments.first.video? + .video-player>< + - if status.sensitive? + = render partial: 'stream_entries/content_spoiler' + %video.u-video{ src: status.media_attachments.first.file.url(:original), loop: true } + - else + .detailed-status__attachments>< + - if status.sensitive? + = render partial: 'stream_entries/content_spoiler' + .status__attachments__inner< + - status.media_attachments.each do |media| + = render partial: 'stream_entries/media', locals: { media: media } .detailed-status__meta %data.dt-published{ value: status.created_at.to_time.iso8601 } diff --git a/app/views/stream_entries/_media.html.haml b/app/views/stream_entries/_media.html.haml index 779f02c8d..32d024cf6 100644 --- a/app/views/stream_entries/_media.html.haml +++ b/app/views/stream_entries/_media.html.haml @@ -1,4 +1,4 @@ -.media-item +.media-item>< = link_to media.remote_url.blank? ? media.file.url(:original) : media.remote_url, style: media.image? ? "background-image: url(#{media.file.url(:original)})" : '', target: '_blank', rel: 'noopener', class: "u-#{media.video? || media.gifv? ? 'video' : 'photo'}" do - unless media.image? %video{ src: media.file.url(:original), autoplay: true, loop: true }/ diff --git a/app/views/stream_entries/_simple_status.html.haml b/app/views/stream_entries/_simple_status.html.haml index db4e30fda..88750180f 100644 --- a/app/views/stream_entries/_simple_status.html.haml +++ b/app/views/stream_entries/_simple_status.html.haml @@ -18,19 +18,20 @@ %p{ style: 'margin-bottom: 0' }< %span.p-summary> #{status.spoiler_text}  %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more') - .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status) + .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }< + = Formatter.instance.format(status) - - unless status.media_attachments.empty? - .status__attachments - - if status.sensitive? - = render partial: 'stream_entries/content_spoiler' - - if status.media_attachments.first.video? - .status__attachments__inner - .video-item - = link_to (status.media_attachments.first.remote_url.blank? ? status.media_attachments.first.file.url(:original) : status.media_attachments.first.remote_url), style: "background-image: url(#{status.media_attachments.first.file.url(:small)})", target: '_blank', rel: 'noopener', class: 'u-video' do - .video-item__play - = fa_icon('play') - - else - .status__attachments__inner - - status.media_attachments.each do |media| - = render partial: 'stream_entries/media', locals: { media: media } + - unless status.media_attachments.empty? + .status__attachments>< + - if status.sensitive? + = render partial: 'stream_entries/content_spoiler' + - if status.media_attachments.first.video? + .status__attachments__inner< + .video-item< + = link_to (status.media_attachments.first.remote_url.blank? ? status.media_attachments.first.file.url(:original) : status.media_attachments.first.remote_url), style: "background-image: url(#{status.media_attachments.first.file.url(:small)})", target: '_blank', rel: 'noopener', class: 'u-video' do + .video-item__play + = fa_icon('play') + - else + .status__attachments__inner< + - status.media_attachments.each do |media| + = render partial: 'stream_entries/media', locals: { media: media } -- cgit From 74eff5456c8655e6783ffe49a96042320af3848c Mon Sep 17 00:00:00 2001 From: DJ Sundog Date: Tue, 11 Jul 2017 17:32:16 -0700 Subject: First lame pass at adding optional git commit hash display on /about/… (#67) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * First lame pass at adding optional git commit hash display on /about/more page. Currently, this is implemented by checking for the existence of a file called CURRENT_RELEASE in the home directory of the user running Mastodon. If the file exists, its contents are added. I've modified my update process to include the following before precompiling assets: git log -1 | head -n 1 | cut -d " " -f2 > ~/CURRENT_RELEASE That puts the current commit hash into the file ~/CURRENT_RELEASE, but you figured that out because you're a smart cookie. As I am quite sure this is a horrible methodology for implementing this, I look forward to any improvements you have to offer! * Updated to handle instances that share a user - the CURRENT_RELEASE file now lives in the instance's base directory. This also requires modifying the update hook to `git log -1 | head -n 1 | cut -d " " -f2 > CURRENT_RELEASE` --- app/presenters/instance_presenter.rb | 9 +++++++++ app/views/about/_version.html.haml | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb index 9a69809d0..c96eaa1cb 100644 --- a/app/presenters/instance_presenter.rb +++ b/app/presenters/instance_presenter.rb @@ -29,4 +29,13 @@ class InstancePresenter def version_number Mastodon::Version end + + def commit_hash + current_release_file = Pathname.new('CURRENT_RELEASE').expand_path + if current_release_file.file? + IO.read(current_release_file) + else + "" + end + end end diff --git a/app/views/about/_version.html.haml b/app/views/about/_version.html.haml index f8ebc4c6d..3ed35da51 100644 --- a/app/views/about/_version.html.haml +++ b/app/views/about/_version.html.haml @@ -1,4 +1,9 @@ .panel .panel-header= t 'about.version' .panel-body - %strong= version.version_number + - if @instance_presenter.commit_hash == "" + %strong= version.version_number + - else + %strong= version.version_number + %strong= "#{@instance_presenter.commit_hash}" + -- cgit From 0a678cf377c6dd91c439fa91f75782e457836639 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Tue, 18 Jul 2017 11:21:04 -0700 Subject: Fix for stylesheet split --- app/javascript/glitch/components/settings/index.js | 9 +-- .../glitch/components/settings/style.scss | 84 ++++++++++++++++++++++ .../glitch/components/settings/stylesheet.scss | 84 ---------------------- app/views/home/index.html.haml | 1 + config/webpack/shared.js | 5 +- 5 files changed, 94 insertions(+), 89 deletions(-) create mode 100644 app/javascript/glitch/components/settings/style.scss delete mode 100644 app/javascript/glitch/components/settings/stylesheet.scss (limited to 'app/views') diff --git a/app/javascript/glitch/components/settings/index.js b/app/javascript/glitch/components/settings/index.js index 04c05704e..ab2e0fb87 100644 --- a/app/javascript/glitch/components/settings/index.js +++ b/app/javascript/glitch/components/settings/index.js @@ -1,14 +1,15 @@ -// Package imports // +// Package imports import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; -import './stylesheet'; - -// Our imports // +// Our imports import SettingsItem from './item'; +// Stylesheet imports +import './style'; + const messages = defineMessages({ layout_auto: { id: 'layout.auto', defaultMessage: 'Auto' }, layout_desktop: { id: 'layout.desktop', defaultMessage: 'Desktop' }, diff --git a/app/javascript/glitch/components/settings/style.scss b/app/javascript/glitch/components/settings/style.scss new file mode 100644 index 000000000..48cc37984 --- /dev/null +++ b/app/javascript/glitch/components/settings/style.scss @@ -0,0 +1,84 @@ +@import 'variables'; + +.settings-modal { + position: relative; + display: flex; + flex-direction: row; + background: $ui-secondary-color; + color: $ui-base-color; + border-radius: 8px; + height: 80vh; + width: 80vw; + max-width: 740px; + max-height: 450px; + overflow: hidden; + + label { + display: block; + } + + h1 { + font-size: 18px; + font-weight: 500; + line-height: 24px; + margin-bottom: 20px; + } + + h2 { + font-size: 15px; + font-weight: 500; + line-height: 20px; + margin-top: 20px; + margin-bottom: 10px; + } +} + +.settings-modal__navigation { + background: $primary-text-color; + color: $ui-base-color; + width: 200px; + font-size: 15px; + line-height: 20px; + overflow-y: auto; + + .settings-modal__navigation-item, .settings-modal__navigation-close { + display: block; + padding: 15px 20px; + cursor: pointer; + outline: none; + text-decoration: none; + } + + .settings-modal__navigation-item { + background: $primary-text-color; + color: inherit; + border-bottom: 1px $ui-primary-color solid; + transition: background .3s; + + &:hover { + background: $ui-secondary-color; + } + + &.active { + background: $ui-highlight-color; + color: $primary-text-color; + } + } + + .settings-modal__navigation-close { + background: $error-value-color; + color: $primary-text-color; + } +} + +.settings-modal__content { + display: block; + flex: auto; + padding: 15px 20px 15px 20px; + width: 360px; + overflow-y: auto; + + select { + margin-bottom: 5px; + } +} \ No newline at end of file diff --git a/app/javascript/glitch/components/settings/stylesheet.scss b/app/javascript/glitch/components/settings/stylesheet.scss deleted file mode 100644 index 48cc37984..000000000 --- a/app/javascript/glitch/components/settings/stylesheet.scss +++ /dev/null @@ -1,84 +0,0 @@ -@import 'variables'; - -.settings-modal { - position: relative; - display: flex; - flex-direction: row; - background: $ui-secondary-color; - color: $ui-base-color; - border-radius: 8px; - height: 80vh; - width: 80vw; - max-width: 740px; - max-height: 450px; - overflow: hidden; - - label { - display: block; - } - - h1 { - font-size: 18px; - font-weight: 500; - line-height: 24px; - margin-bottom: 20px; - } - - h2 { - font-size: 15px; - font-weight: 500; - line-height: 20px; - margin-top: 20px; - margin-bottom: 10px; - } -} - -.settings-modal__navigation { - background: $primary-text-color; - color: $ui-base-color; - width: 200px; - font-size: 15px; - line-height: 20px; - overflow-y: auto; - - .settings-modal__navigation-item, .settings-modal__navigation-close { - display: block; - padding: 15px 20px; - cursor: pointer; - outline: none; - text-decoration: none; - } - - .settings-modal__navigation-item { - background: $primary-text-color; - color: inherit; - border-bottom: 1px $ui-primary-color solid; - transition: background .3s; - - &:hover { - background: $ui-secondary-color; - } - - &.active { - background: $ui-highlight-color; - color: $primary-text-color; - } - } - - .settings-modal__navigation-close { - background: $error-value-color; - color: $primary-text-color; - } -} - -.settings-modal__content { - display: block; - flex: auto; - padding: 15px 20px 15px 20px; - width: 360px; - overflow-y: auto; - - select { - margin-bottom: 5px; - } -} \ No newline at end of file diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 13ca9ea79..f0f7bd619 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -3,6 +3,7 @@ %script#initial-state{ type: 'application/json' }!= json_escape(@initial_state_json) = javascript_pack_tag 'application', integrity: true, crossorigin: 'anonymous' + = stylesheet_pack_tag 'application', media: 'all' .app-holder#mastodon{ data: { props: Oj.dump(default_props) } } %noscript diff --git a/config/webpack/shared.js b/config/webpack/shared.js index 4d865b816..98e864a66 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -44,7 +44,10 @@ module.exports = { plugins: [ new webpack.EnvironmentPlugin(JSON.parse(JSON.stringify(env))), - new ExtractTextPlugin(env.NODE_ENV === 'production' ? '[name]-[hash].css' : '[name].css'), + new ExtractTextPlugin({ + filename: env.NODE_ENV === 'production' ? '[name]-[hash].css' : '[name].css', + allChunks: true, + }), new ManifestPlugin({ publicPath: output.publicPath, writeToFileEmit: true, -- cgit From b7cf758fbed204f117350bc8636fc3d610f60eb4 Mon Sep 17 00:00:00 2001 From: Ondřej Hruška Date: Tue, 25 Jul 2017 21:54:12 +0200 Subject: Fix JS errors and add back commit hash --- .../mastodon/features/compose/components/compose_form.js | 1 - app/presenters/instance_presenter.rb | 4 ++-- app/views/about/more.html.haml | 8 ++++++-- app/views/about/show.html.haml | 8 ++++++-- 4 files changed, 14 insertions(+), 7 deletions(-) (limited to 'app/views') diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index 708978481..67906594f 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -19,7 +19,6 @@ import WarningContainer from '../containers/warning_container'; import { isMobile } from '../../../is_mobile'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { length } from 'stringz'; -import { isMobile } from '../../../is_mobile'; const messages = defineMessages({ placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' }, diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb index 19bedcc21..4de6b5e0d 100644 --- a/app/presenters/instance_presenter.rb +++ b/app/presenters/instance_presenter.rb @@ -35,9 +35,9 @@ class InstancePresenter def commit_hash current_release_file = Pathname.new('CURRENT_RELEASE').expand_path if current_release_file.file? - IO.read(current_release_file) + IO.read(current_release_file).strip! else - "" + '' end end end diff --git a/app/views/about/more.html.haml b/app/views/about/more.html.haml index 11315fefa..ed491495b 100644 --- a/app/views/about/more.html.haml +++ b/app/views/about/more.html.haml @@ -60,5 +60,9 @@ .footer-links .container %p - = link_to t('about.source_code'), 'https://github.com/tootsuite/mastodon' - = " (#{@instance_presenter.version_number})" + = link_to t('about.source_code'), 'https://github.com/glitch-soc/mastodon' + - if @instance_presenter.commit_hash == "" + %strong= @instance_presenter.version_number + - else + %strong= "#{@instance_presenter.version_number}, " + %strong= "#{@instance_presenter.commit_hash}" diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml index a3c8e4a84..b78e181ec 100644 --- a/app/views/about/show.html.haml +++ b/app/views/about/show.html.haml @@ -73,5 +73,9 @@ .footer-links .container %p - = link_to t('about.source_code'), 'https://github.com/tootsuite/mastodon' - = " (#{@instance_presenter.version_number})" + = link_to t('about.source_code'), 'https://github.com/glitch-soc/mastodon' + - if @instance_presenter.commit_hash == "" + %strong= " (#{@instance_presenter.version_number})" + - else + %strong= " (#{@instance_presenter.version_number}, " + %strong= " #{@instance_presenter.commit_hash})" -- cgit From 4c233b4f3a9cee68178aa1758c8bb4c0c8508650 Mon Sep 17 00:00:00 2001 From: Ondřej Hruška Date: Tue, 25 Jul 2017 23:30:13 +0200 Subject: Add .fa-external-link to instance list link --- app/views/about/more.html.haml | 5 ++++- app/views/about/show.html.haml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'app/views') diff --git a/app/views/about/more.html.haml b/app/views/about/more.html.haml index ed491495b..6d621ce8b 100644 --- a/app/views/about/more.html.haml +++ b/app/views/about/more.html.haml @@ -29,7 +29,10 @@ - else = link_to t('auth.login'), new_user_session_path, class: 'webapp-btn' %li= link_to t('about.about_this'), about_more_path - %li= link_to t('about.other_instances'), 'https://joinmastodon.org/' + %li + = link_to 'https://joinmastodon.org/' do + = "#{t('about.other_instances')}" + %i.fa.fa-external-link{ style: 'padding-left: 5px;' } .container.hero .heading diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml index b78e181ec..3e04dd038 100644 --- a/app/views/about/show.html.haml +++ b/app/views/about/show.html.haml @@ -33,7 +33,10 @@ - else = link_to t('auth.login'), new_user_session_path, class: 'webapp-btn' %li= link_to t('about.about_this'), about_more_path - %li= link_to t('about.other_instances'), 'https://joinmastodon.org/' + %li + = link_to 'https://joinmastodon.org/' do + = "#{t('about.other_instances')}" + %i.fa.fa-external-link{ style: 'padding-left: 5px;' } .container.hero .floats -- cgit From b61e3daf983d87c6d2de7e54d420c2e8f5a531e6 Mon Sep 17 00:00:00 2001 From: Gô Shoemake Date: Sun, 30 Jul 2017 10:28:21 -0700 Subject: Multiple frontend support (#110) * Initial multiple frontend support * Removed unnecessary require() * Moved styles/images out of common --- app/controllers/home_controller.rb | 1 + app/javascript/packs/application.js | 6 ++++++ app/javascript/packs/common.js | 7 ++----- app/javascript/packs/frontends/mastodon.js | 16 ++++++++++++++++ app/javascript/styles/application.scss | 3 --- app/javascript/styles/common.scss | 5 +++++ app/views/home/index.html.haml | 4 ++-- app/views/layouts/application.html.haml | 3 +++ config/initializers/frontends.rb | 7 +++++++ config/webpack/shared.js | 15 ++------------- 10 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 app/javascript/packs/frontends/mastodon.js create mode 100644 app/javascript/styles/common.scss create mode 100644 config/initializers/frontends.rb (limited to 'app/views') diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 1585bc810..fbfb5473e 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -6,6 +6,7 @@ class HomeController < ApplicationController def index @body_classes = 'app-body' + @frontend = (params[:frontend] and Rails.configuration.x.available_frontends.include? params[:frontend] + '.js') ? params[:frontend] : 'mastodon' end private diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 116632dea..c06714dc1 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -1,5 +1,11 @@ import loadPolyfills from '../mastodon/load_polyfills'; +// import default stylesheet with variables +require('font-awesome/css/font-awesome.css'); +require('mastodon-application-style'); + +require.context('../images/', true); + loadPolyfills().then(() => { require('../mastodon/main').default(); }).catch(e => { diff --git a/app/javascript/packs/common.js b/app/javascript/packs/common.js index ba7053f1f..de0c68fa5 100644 --- a/app/javascript/packs/common.js +++ b/app/javascript/packs/common.js @@ -1,9 +1,6 @@ import { start } from 'rails-ujs'; -// import default stylesheet with variables -require('font-awesome/css/font-awesome.css'); -require('mastodon-application-style'); - -require.context('../images/', true); +// import common styling +require('../styles/common.scss'); start(); diff --git a/app/javascript/packs/frontends/mastodon.js b/app/javascript/packs/frontends/mastodon.js new file mode 100644 index 000000000..a983de36f --- /dev/null +++ b/app/javascript/packs/frontends/mastodon.js @@ -0,0 +1,16 @@ +// This file replaces `app/javascript/packs/application.js` for use +// with multiple frontends. + +import loadPolyfills from '../../mastodon/load_polyfills'; + +// import default stylesheet with variables +require('font-awesome/css/font-awesome.css'); +require('mastodon-application-style'); + +require.context('../../images/', true); + +loadPolyfills().then(() => { + require('../../mastodon/main').default(); +}).catch(e => { + console.error(e); +}); diff --git a/app/javascript/styles/application.scss b/app/javascript/styles/application.scss index b08b69449..33c7783f3 100644 --- a/app/javascript/styles/application.scss +++ b/app/javascript/styles/application.scss @@ -1,9 +1,6 @@ @import 'mixins'; @import 'variables'; @import 'variables-glitch'; -@import 'fonts/roboto'; -@import 'fonts/roboto-mono'; -@import 'fonts/montserrat'; @import 'reset'; @import 'basics'; diff --git a/app/javascript/styles/common.scss b/app/javascript/styles/common.scss new file mode 100644 index 000000000..c1772e7ae --- /dev/null +++ b/app/javascript/styles/common.scss @@ -0,0 +1,5 @@ +// This makes our fonts available everywhere. + +@import 'fonts/roboto'; +@import 'fonts/roboto-mono'; +@import 'fonts/montserrat'; diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 1ed5c1ae0..ec6e53461 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -2,8 +2,8 @@ %meta{name: 'applicationServerKey', content: Rails.configuration.x.vapid_public_key} %script#initial-state{ type: 'application/json' }!= json_escape(@initial_state_json) - = javascript_pack_tag 'application', integrity: true, crossorigin: 'anonymous' - = stylesheet_pack_tag 'application', media: 'all' + = javascript_pack_tag "frontends/#{@frontend}", integrity: true, crossorigin: 'anonymous' + = stylesheet_pack_tag "frontends/#{@frontend}", integrity: true, media: 'all' .app-holder#mastodon{ data: { props: Oj.dump(default_props) } } %noscript diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 82b20810a..399d70bc0 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -32,6 +32,9 @@ = javascript_pack_tag "locale_#{I18n.locale}", integrity: true, crossorigin: 'anonymous' = csrf_meta_tags + - if controller_name != 'home' + = stylesheet_pack_tag 'application', integrity: true, media: 'all' + = yield :header_tags - body_classes ||= @body_classes diff --git a/config/initializers/frontends.rb b/config/initializers/frontends.rb new file mode 100644 index 000000000..2cb68cc61 --- /dev/null +++ b/config/initializers/frontends.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.configure do + frontends = [] + Rails.root.join('app', 'javascript', 'packs', 'frontends').each_child(false) { |f| frontends.push f.to_s } + config.x.available_frontends = frontends +end diff --git a/config/webpack/shared.js b/config/webpack/shared.js index 98e864a66..425918d66 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -2,7 +2,7 @@ const { existsSync } = require('fs'); const webpack = require('webpack'); -const { basename, dirname, join, relative, resolve, sep } = require('path'); +const { basename, dirname, join, relative, resolve } = require('path'); const { sync } = require('glob'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ManifestPlugin = require('webpack-manifest-plugin'); @@ -54,18 +54,7 @@ module.exports = { }), new webpack.optimize.CommonsChunkPlugin({ name: 'common', - minChunks: (module, count) => { - const reactIntlPathRegexp = new RegExp(`node_modules\\${sep}react-intl`); - - if (module.resource && reactIntlPathRegexp.test(module.resource)) { - // skip react-intl because it's useless to put in the common chunk, - // e.g. because "shared" modules between zh-TW and zh-CN will never - // be loaded together - return false; - } - - return count >= 2; - }, + minChunks: Infinity, // It doesn't make sense to use common chunks with multiple frontend support. }), ], -- cgit From 15c9c2fd7e5603d48b5eeb966963138b454cfe2a Mon Sep 17 00:00:00 2001 From: kibigo! Date: Wed, 20 Sep 2017 02:50:53 -0700 Subject: Pinned toots; embeds --- .../glitch/components/status/action_bar.js | 56 ++++++++++++++++------ .../glitch/components/status/container.js | 14 ++++++ app/javascript/glitch/components/status/index.js | 3 ++ app/views/layouts/embedded.html.haml | 1 + 4 files changed, 60 insertions(+), 14 deletions(-) (limited to 'app/views') diff --git a/app/javascript/glitch/components/status/action_bar.js b/app/javascript/glitch/components/status/action_bar.js index 7c73002c1..d4d26c62c 100644 --- a/app/javascript/glitch/components/status/action_bar.js +++ b/app/javascript/glitch/components/status/action_bar.js @@ -8,7 +8,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; // Mastodon imports // import RelativeTimestamp from '../../../mastodon/components/relative_timestamp'; import IconButton from '../../../mastodon/components/icon_button'; -import DropdownMenu from '../../../mastodon/components/dropdown_menu'; +import DropdownMenuContainer from '../../../mastodon/containers/dropdown_menu_container'; const messages = defineMessages({ delete: { id: 'status.delete', defaultMessage: 'Delete' }, @@ -16,6 +16,7 @@ const messages = defineMessages({ mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' }, block: { id: 'account.block', defaultMessage: 'Block @{name}' }, reply: { id: 'status.reply', defaultMessage: 'Reply' }, + share: { id: 'status.share', defaultMessage: 'Share' }, replyAll: { id: 'status.replyAll', defaultMessage: 'Reply to thread' }, reblog: { id: 'status.reblog', defaultMessage: 'Boost' }, cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' }, @@ -24,6 +25,9 @@ const messages = defineMessages({ report: { id: 'status.report', defaultMessage: 'Report @{name}' }, muteConversation: { id: 'status.mute_conversation', defaultMessage: 'Mute conversation' }, unmuteConversation: { id: 'status.unmute_conversation', defaultMessage: 'Unmute conversation' }, + pin: { id: 'status.pin', defaultMessage: 'Pin on profile' }, + unpin: { id: 'status.unpin', defaultMessage: 'Unpin from profile' }, + embed: { id: 'status.embed', defaultMessage: 'Embed' }, }); @injectIntl @@ -43,7 +47,9 @@ export default class StatusActionBar extends ImmutablePureComponent { onMute: PropTypes.func, onBlock: PropTypes.func, onReport: PropTypes.func, + onEmbed: PropTypes.func, onMuteConversation: PropTypes.func, + onPin: PropTypes.func, me: PropTypes.number, withDismiss: PropTypes.bool, intl: PropTypes.object.isRequired, @@ -61,6 +67,13 @@ export default class StatusActionBar extends ImmutablePureComponent { this.props.onReply(this.props.status, this.context.router.history); } + handleShareClick = () => { + navigator.share({ + text: this.props.status.get('search_index'), + url: this.props.status.get('url'), + }); + } + handleFavouriteClick = () => { this.props.onFavourite(this.props.status); } @@ -73,6 +86,10 @@ export default class StatusActionBar extends ImmutablePureComponent { this.props.onDelete(this.props.status); } + handlePinClick = () => { + this.props.onPin(this.props.status); + } + handleMentionClick = () => { this.props.onMention(this.props.status.get('account'), this.context.router.history); } @@ -89,6 +106,10 @@ export default class StatusActionBar extends ImmutablePureComponent { this.context.router.history.push(`/statuses/${this.props.status.get('id')}`); } + handleEmbed = () => { + this.props.onEmbed(this.props.status); + } + handleReport = () => { this.props.onReport(this.props.status); } @@ -99,9 +120,10 @@ export default class StatusActionBar extends ImmutablePureComponent { render () { const { status, me, intl, withDismiss } = this.props; - const reblogDisabled = status.get('visibility') === 'private' || status.get('visibility') === 'direct'; + const mutingConversation = status.get('muted'); const anonymousAccess = !me; + const publicStatus = ['public', 'unlisted'].includes(status.get('visibility')); let menu = []; let reblogIcon = 'retweet'; @@ -109,14 +131,23 @@ export default class StatusActionBar extends ImmutablePureComponent { let replyTitle; menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen }); + + if (publicStatus) { + menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); + } + menu.push(null); - if (withDismiss) { + if (status.getIn(['account', 'id']) === me || withDismiss) { menu.push({ text: intl.formatMessage(mutingConversation ? messages.unmuteConversation : messages.muteConversation), action: this.handleConversationMuteClick }); menu.push(null); } if (status.getIn(['account', 'id']) === me) { + if (publicStatus) { + menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick }); + } + menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick }); } else { menu.push({ text: intl.formatMessage(messages.mention, { name: status.getIn(['account', 'username']) }), action: this.handleMentionClick }); @@ -126,14 +157,6 @@ export default class StatusActionBar extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.report, { name: status.getIn(['account', 'username']) }), action: this.handleReport }); } - /* - if (status.get('visibility') === 'direct') { - reblogIcon = 'envelope'; - } else if (status.get('visibility') === 'private') { - reblogIcon = 'lock'; - } - */ - if (status.get('in_reply_to_id', null) === null) { replyIcon = 'reply'; replyTitle = intl.formatMessage(messages.reply); @@ -142,14 +165,19 @@ export default class StatusActionBar extends ImmutablePureComponent { replyTitle = intl.formatMessage(messages.replyAll); } + const shareButton = ('share' in navigator) && status.get('visibility') === 'public' && ( + + ); + return (
- - + + + {shareButton}
- +
diff --git a/app/javascript/glitch/components/status/container.js b/app/javascript/glitch/components/status/container.js index b4d7fb4cc..da2771c0b 100644 --- a/app/javascript/glitch/components/status/container.js +++ b/app/javascript/glitch/components/status/container.js @@ -38,6 +38,8 @@ import { favourite, unreblog, unfavourite, + pin, + unpin, } from '../../../mastodon/actions/interactions'; import { blockAccount } from '../../../mastodon/actions/accounts'; import { initMuteModal } from '../../../mastodon/actions/mutes'; @@ -187,6 +189,18 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ } }, + onPin (status) { + if (status.get('pinned')) { + dispatch(unpin(status)); + } else { + dispatch(pin(status)); + } + }, + + onEmbed (status) { + dispatch(openModal('EMBED', { url: status.get('url') })); + }, + onDelete (status) { if (!this.deleteModal) { dispatch(deleteStatus(status.get('id'))); diff --git a/app/javascript/glitch/components/status/index.js b/app/javascript/glitch/components/status/index.js index 55e6f1876..4a2a0e1d4 100644 --- a/app/javascript/glitch/components/status/index.js +++ b/app/javascript/glitch/components/status/index.js @@ -165,10 +165,13 @@ export default class Status extends ImmutablePureComponent { onReblog : PropTypes.func, onModalReblog : PropTypes.func, onDelete : PropTypes.func, + onPin : PropTypes.func, onMention : PropTypes.func, onMute : PropTypes.func, onMuteConversation : PropTypes.func, onBlock : PropTypes.func, + onEmbed : PropTypes.func, + onHeightChange : PropTypes.func, onReport : PropTypes.func, onOpenMedia : PropTypes.func, onOpenVideo : PropTypes.func, diff --git a/app/views/layouts/embedded.html.haml b/app/views/layouts/embedded.html.haml index 46dab2d0f..5fc60be17 100644 --- a/app/views/layouts/embedded.html.haml +++ b/app/views/layouts/embedded.html.haml @@ -6,6 +6,7 @@ = stylesheet_pack_tag 'common', media: 'all' = javascript_pack_tag 'common', integrity: true, crossorigin: 'anonymous' + = stylesheet_pack_tag 'application', integrity: true, media: 'all' = javascript_pack_tag "locale_#{I18n.locale}", integrity: true, crossorigin: 'anonymous' = javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous' %body.embed -- cgit From 86e617a839bd4eb45ace52ab226a4e93bb184ff0 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Mon, 25 Sep 2017 19:24:32 -0700 Subject: Better themeing support!! --- app/controllers/application_controller.rb | 6 ++++ app/controllers/settings/preferences_controller.rb | 1 + .../local_settings/navigation/item/style.scss | 2 +- .../local_settings/navigation/style.scss | 2 +- .../components/local_settings/page/item/style.scss | 2 +- .../components/local_settings/page/style.scss | 2 +- .../glitch/components/local_settings/style.scss | 2 +- app/javascript/packs/application.js | 2 +- app/javascript/packs/frontends/mastodon.js | 16 ---------- app/javascript/styles/custom.scss | 1 - app/javascript/themes/default/theme.yml | 9 ++++++ app/javascript/themes/spin/pack.js | 2 ++ app/javascript/themes/spin/style.scss | 14 ++++++++ app/javascript/themes/spin/theme.yml | 2 ++ app/lib/themes.rb | 23 ++++++++++++++ app/lib/user_settings_decorator.rb | 5 +++ app/models/user.rb | 4 +++ app/views/home/index.html.haml | 4 +-- app/views/settings/preferences/show.html.haml | 2 ++ config/initializers/frontends.rb | 7 ---- config/locales/simple_form.en.yml | 2 ++ config/settings.yml | 1 + config/webpack/configuration.js | 17 +++++++++- config/webpack/loaders/sass.js | 2 +- config/webpack/shared.js | 37 ++++++++++++---------- 25 files changed, 117 insertions(+), 50 deletions(-) delete mode 100644 app/javascript/packs/frontends/mastodon.js delete mode 100644 app/javascript/styles/custom.scss create mode 100644 app/javascript/themes/default/theme.yml create mode 100644 app/javascript/themes/spin/pack.js create mode 100644 app/javascript/themes/spin/style.scss create mode 100644 app/javascript/themes/spin/theme.yml create mode 100644 app/lib/themes.rb delete mode 100644 config/initializers/frontends.rb (limited to 'app/views') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0b40fb05b..d5eca6ffb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,6 +12,7 @@ class ApplicationController < ActionController::Base helper_method :current_account helper_method :current_session + helper_method :current_theme helper_method :single_user_mode? rescue_from ActionController::RoutingError, with: :not_found @@ -77,6 +78,11 @@ class ApplicationController < ActionController::Base @current_session ||= SessionActivation.find_by(session_id: cookies.signed['_session_id']) end + def current_theme + return Setting.default_settings['theme'] unless Themes.instance.names.include? current_user&.setting_theme + current_user.setting_theme + end + def cache_collection(raw, klass) return raw unless klass.respond_to?(:with_includes) diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index f107f2b16..207c7b324 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -41,6 +41,7 @@ class Settings::PreferencesController < ApplicationController :setting_auto_play_gif, :setting_system_font_ui, :setting_noindex, + :setting_theme, notification_emails: %i(follow follow_request reblog favourite mention digest), interactions: %i(must_be_follower must_be_following) ) diff --git a/app/javascript/glitch/components/local_settings/navigation/item/style.scss b/app/javascript/glitch/components/local_settings/navigation/item/style.scss index 505c86912..33d7d3744 100644 --- a/app/javascript/glitch/components/local_settings/navigation/item/style.scss +++ b/app/javascript/glitch/components/local_settings/navigation/item/style.scss @@ -1,4 +1,4 @@ -@import 'variables'; +@import 'styles/variables'; .glitch.local-settings__navigation__item { display: block; diff --git a/app/javascript/glitch/components/local_settings/navigation/style.scss b/app/javascript/glitch/components/local_settings/navigation/style.scss index 1cc39e3e9..a610a1212 100644 --- a/app/javascript/glitch/components/local_settings/navigation/style.scss +++ b/app/javascript/glitch/components/local_settings/navigation/style.scss @@ -1,4 +1,4 @@ -@import 'variables'; +@import 'styles/variables'; .glitch.local-settings__navigation { background: $primary-text-color; diff --git a/app/javascript/glitch/components/local_settings/page/item/style.scss b/app/javascript/glitch/components/local_settings/page/item/style.scss index e614030c0..da1941b99 100644 --- a/app/javascript/glitch/components/local_settings/page/item/style.scss +++ b/app/javascript/glitch/components/local_settings/page/item/style.scss @@ -1,4 +1,4 @@ -@import 'variables'; +@import 'styles/variables'; .glitch.local-settings__page__item { select { diff --git a/app/javascript/glitch/components/local_settings/page/style.scss b/app/javascript/glitch/components/local_settings/page/style.scss index 7269056c3..53c95ea40 100644 --- a/app/javascript/glitch/components/local_settings/page/style.scss +++ b/app/javascript/glitch/components/local_settings/page/style.scss @@ -1,4 +1,4 @@ -@import 'variables'; +@import 'styles/variables'; .glitch.local-settings__page { display: block; diff --git a/app/javascript/glitch/components/local_settings/style.scss b/app/javascript/glitch/components/local_settings/style.scss index 6f7fcbaa4..54fec47bd 100644 --- a/app/javascript/glitch/components/local_settings/style.scss +++ b/app/javascript/glitch/components/local_settings/style.scss @@ -1,4 +1,4 @@ -@import 'variables'; +@import 'styles/variables'; .glitch.local-settings { position: relative; diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index c06714dc1..aa94006c6 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -2,7 +2,7 @@ import loadPolyfills from '../mastodon/load_polyfills'; // import default stylesheet with variables require('font-awesome/css/font-awesome.css'); -require('mastodon-application-style'); +import 'styles/application'; require.context('../images/', true); diff --git a/app/javascript/packs/frontends/mastodon.js b/app/javascript/packs/frontends/mastodon.js deleted file mode 100644 index a983de36f..000000000 --- a/app/javascript/packs/frontends/mastodon.js +++ /dev/null @@ -1,16 +0,0 @@ -// This file replaces `app/javascript/packs/application.js` for use -// with multiple frontends. - -import loadPolyfills from '../../mastodon/load_polyfills'; - -// import default stylesheet with variables -require('font-awesome/css/font-awesome.css'); -require('mastodon-application-style'); - -require.context('../../images/', true); - -loadPolyfills().then(() => { - require('../../mastodon/main').default(); -}).catch(e => { - console.error(e); -}); diff --git a/app/javascript/styles/custom.scss b/app/javascript/styles/custom.scss deleted file mode 100644 index 97a981243..000000000 --- a/app/javascript/styles/custom.scss +++ /dev/null @@ -1 +0,0 @@ -@import 'application'; diff --git a/app/javascript/themes/default/theme.yml b/app/javascript/themes/default/theme.yml new file mode 100644 index 000000000..6a7a872b4 --- /dev/null +++ b/app/javascript/themes/default/theme.yml @@ -0,0 +1,9 @@ +# (REQUIRED) Name must be unique across all installed themes. +name: default + +# (REQUIRED) The location of the pack file inside `pack_directory`. +pack: application.js + +# (OPTIONAL) The directory which contains the pack file. +# Defaults to the theme directory (`app/javascript/themes/[theme]`). +pack_directory: app/javascript/packs diff --git a/app/javascript/themes/spin/pack.js b/app/javascript/themes/spin/pack.js new file mode 100644 index 000000000..dab0e93a4 --- /dev/null +++ b/app/javascript/themes/spin/pack.js @@ -0,0 +1,2 @@ +import 'packs/application'; +import 'themes/spin/style'; diff --git a/app/javascript/themes/spin/style.scss b/app/javascript/themes/spin/style.scss new file mode 100644 index 000000000..1a9381fd0 --- /dev/null +++ b/app/javascript/themes/spin/style.scss @@ -0,0 +1,14 @@ +:root:root:root { + .button, .icon-button, .emoji-button, .account__avatar, .account__avatar-overlay { + animation: spin 4s linear infinite; + } +} + +@keyframes spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/app/javascript/themes/spin/theme.yml b/app/javascript/themes/spin/theme.yml new file mode 100644 index 000000000..a684997dc --- /dev/null +++ b/app/javascript/themes/spin/theme.yml @@ -0,0 +1,2 @@ +name: spin +pack: pack.js \ No newline at end of file diff --git a/app/lib/themes.rb b/app/lib/themes.rb new file mode 100644 index 000000000..2dd188297 --- /dev/null +++ b/app/lib/themes.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'singleton' +require 'yaml' + +class Themes + include Singleton + + def initialize + result = Hash.new + Dir.glob(Rails.root.join('app', 'javascript', 'themes', '*', 'theme.yml')) do |path| + data = YAML.load_file(path) + if data['pack'] && data['name'] + result[data['name']] = data + end + end + @conf = result + end + + def names + @conf.keys + end +end diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb index 62046ed72..3b156b98c 100644 --- a/app/lib/user_settings_decorator.rb +++ b/app/lib/user_settings_decorator.rb @@ -25,6 +25,7 @@ class UserSettingsDecorator user.settings['auto_play_gif'] = auto_play_gif_preference user.settings['system_font_ui'] = system_font_ui_preference user.settings['noindex'] = noindex_preference + user.settings['theme'] = theme_preference end def merged_notification_emails @@ -67,6 +68,10 @@ class UserSettingsDecorator boolean_cast_setting 'setting_noindex' end + def theme_preference + settings['setting_theme'] + end + def boolean_cast_setting(key) settings[key] == '1' end diff --git a/app/models/user.rb b/app/models/user.rb index 5e548c1ef..3bf069a31 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -110,6 +110,10 @@ class User < ApplicationRecord settings.noindex end + def setting_theme + settings.theme + end + def token_for_app(a) return nil if a.nil? || a.owner != self Doorkeeper::AccessToken diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index a13d0702b..3b4219c56 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -2,8 +2,8 @@ %meta{name: 'applicationServerKey', content: Rails.configuration.x.vapid_public_key} %script#initial-state{ type: 'application/json' }!= json_escape(@initial_state_json) - = javascript_pack_tag "frontends/#{@frontend}", integrity: true, crossorigin: 'anonymous' - = stylesheet_pack_tag "frontends/#{@frontend}", integrity: true, media: 'all' + = javascript_pack_tag "themes/#{current_theme}", integrity: true, crossorigin: 'anonymous' + = stylesheet_pack_tag "themes/#{current_theme}", integrity: true, media: 'all' .app-holder#mastodon{ data: { props: Oj.dump(default_props) } } %noscript diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml index f42f92508..5efd538e4 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -5,6 +5,8 @@ = render 'shared/error_messages', object: current_user .fields-group + = f.input :setting_theme, collection: Themes.instance.names, label_method: lambda { |theme| safe_join([I18n.t("themes.#{theme}", default: theme)])}, wrapper: :with_label, include_blank: false + = f.input :locale, collection: I18n.available_locales, wrapper: :with_label, diff --git a/config/initializers/frontends.rb b/config/initializers/frontends.rb deleted file mode 100644 index 2cb68cc61..000000000 --- a/config/initializers/frontends.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Rails.application.configure do - frontends = [] - Rails.root.join('app', 'javascript', 'packs', 'frontends').each_child(false) { |f| frontends.push f.to_s } - config.x.available_frontends = frontends -end diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index fb8524a24..f9d4e2e52 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -13,6 +13,7 @@ en: one: 1 character left other: %{count} characters left setting_noindex: Affects your public profile and status pages + setting_theme: Affects how Mastodon looks when you're logged in from any device. imports: data: CSV file exported from another Mastodon instance sessions: @@ -44,6 +45,7 @@ en: setting_noindex: Opt-out of search engine indexing setting_system_font_ui: Use system's default font setting_unfollow_modal: Show confirmation dialog before unfollowing someone + setting_theme: Site theme severity: Severity type: Import type username: Username diff --git a/config/settings.yml b/config/settings.yml index 39dfb8f55..3cd3307f4 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -24,6 +24,7 @@ defaults: &defaults auto_play_gif: false system_font_ui: false noindex: false + theme: 'default' notification_emails: follow: false reblog: false diff --git a/config/webpack/configuration.js b/config/webpack/configuration.js index 6ef484c3a..606eb97f1 100644 --- a/config/webpack/configuration.js +++ b/config/webpack/configuration.js @@ -1,13 +1,27 @@ // Common configuration for webpacker loaded from config/webpacker.yml -const { join, resolve } = require('path'); +const { dirname, join, resolve } = require('path'); const { env } = require('process'); const { safeLoad } = require('js-yaml'); const { readFileSync } = require('fs'); +const glob = require('glob'); const configPath = resolve('config', 'webpacker.yml'); const loadersDir = join(__dirname, 'loaders'); const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV]; +const themeFiles = glob.sync('app/javascript/themes/*/theme.yml'); +const themes = {}; + +for (let i = 0; i < themeFiles.length; i++) { + const themeFile = themeFiles[i]; + const data = safeLoad(readFileSync(themeFile), 'utf8'); + if (!data.pack_directory) { + data.pack_directory = dirname(themeFile); + } + if (data.name && data.pack) { + themes[data.name] = data; + } +} function removeOuterSlashes(string) { return string.replace(/^\/*/, '').replace(/\/*$/, ''); @@ -29,6 +43,7 @@ const output = { module.exports = { settings, + themes, env, loadersDir, output, diff --git a/config/webpack/loaders/sass.js b/config/webpack/loaders/sass.js index 40e81b43b..96ad7abe8 100644 --- a/config/webpack/loaders/sass.js +++ b/config/webpack/loaders/sass.js @@ -9,7 +9,7 @@ module.exports = { { loader: 'css-loader', options: { minimize: env.NODE_ENV === 'production' } }, { loader: 'postcss-loader', options: { sourceMap: true } }, 'resolve-url-loader', - { loader: 'sass-loader', options: { includePaths: ['app/javascript/styles'] } }, + { loader: 'sass-loader', options: { includePaths: ['app/javascript'] } }, ], }), }; diff --git a/config/webpack/shared.js b/config/webpack/shared.js index be1b49421..ab925b020 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -1,13 +1,12 @@ // Note: You must restart bin/webpack-dev-server for changes to take effect -const { existsSync } = require('fs'); const webpack = require('webpack'); const { basename, dirname, join, relative, resolve } = require('path'); const { sync } = require('glob'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ManifestPlugin = require('webpack-manifest-plugin'); const extname = require('path-complete-extname'); -const { env, settings, output, loadersDir } = require('./configuration.js'); +const { env, settings, themes, output, loadersDir } = require('./configuration.js'); const localePackPaths = require('./generateLocalePacks'); const extensionGlob = `**/*{${settings.extensions.join(',')}}*`; @@ -18,17 +17,27 @@ const entryPacks = [...packPaths, ...localePackPaths].filter(path => path !== jo const customApplicationStyle = resolve(join(settings.source_path, 'styles/custom.scss')); const originalApplicationStyle = resolve(join(settings.source_path, 'styles/application.scss')); +const themePaths = Object.keys(themes).reduce( + (themePaths, name) => { + themeData = themes[name]; + themePaths[`themes/${name}`] = resolve(themeData.pack_directory, themeData.pack); + return themePaths; + }, {} +); + module.exports = { - entry: entryPacks.reduce( - (map, entry) => { - const localMap = map; - let namespace = relative(join(entryPath), dirname(entry)); - if (namespace === join('..', '..', '..', 'tmp', 'packs')) { - namespace = ''; // generated by generateLocalePacks.js - } - localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry); - return localMap; - }, {} + entry: Object.assign( + entryPacks.reduce( + (map, entry) => { + const localMap = map; + let namespace = relative(join(entryPath), dirname(entry)); + if (namespace === join('..', '..', '..', 'tmp', 'packs')) { + namespace = ''; // generated by generateLocalePacks.js + } + localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry); + return localMap; + }, {} + ), themePaths ), output: { @@ -59,10 +68,6 @@ module.exports = { ], resolve: { - alias: { - 'mastodon-application-style': existsSync(customApplicationStyle) ? - customApplicationStyle : originalApplicationStyle, - }, extensions: settings.extensions, modules: [ resolve(settings.source_path), -- cgit From 152279585376c54f1e738983c4046ce6f0bb2448 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 28 Sep 2017 17:18:12 -0700 Subject: new HAML for statuses --- app/views/stream_entries/_detailed_status.html.haml | 18 +++++++----------- app/views/stream_entries/_simple_status.html.haml | 20 ++++++-------------- 2 files changed, 13 insertions(+), 25 deletions(-) (limited to 'app/views') diff --git a/app/views/stream_entries/_detailed_status.html.haml b/app/views/stream_entries/_detailed_status.html.haml index 4c85fef8b..a839b4898 100644 --- a/app/views/stream_entries/_detailed_status.html.haml +++ b/app/views/stream_entries/_detailed_status.html.haml @@ -17,20 +17,16 @@ %p{ style: 'margin-bottom: 0' }< %span.p-summary> #{Formatter.instance.format_spoiler(status)}  %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more') - .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }< - = Formatter.instance.format(status) + .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status, custom_emojify: true) - - unless status.media_attachments.empty? + - if !status.media_attachments.empty? - if status.media_attachments.first.video? - .video-player>< - = render partial: 'stream_entries/content_spoiler', locals: { sensitive: status.sensitive? } - %video.u-video{ src: status.media_attachments.first.file.url(:original), loop: true } + - video = status.media_attachments.first + %div{ data: { component: 'Video', props: Oj.dump(src: video.file.url(:original), preview: video.file.url(:small), sensitive: status.sensitive?, width: 670, height: 380) }}>< - else - .detailed-status__attachments>< - = render partial: 'stream_entries/content_spoiler', locals: { sensitive: status.sensitive? } - .status__attachments__inner< - - status.media_attachments.each do |media| - = render partial: 'stream_entries/media', locals: { media: media } + %div{ data: { component: 'MediaGallery', props: Oj.dump(height: 380, sensitive: status.sensitive?, standalone: true, 'autoPlayGif': current_account&.user&.setting_auto_play_gif, media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json }) }}>< + - elsif status.preview_cards.first + %div{ data: { component: 'Card', props: Oj.dump('maxDescription': 160, card: ActiveModelSerializers::SerializableResource.new(status.preview_cards.first, serializer: REST::PreviewCardSerializer).as_json) }}>< .detailed-status__meta %data.dt-published{ value: status.created_at.to_time.iso8601 } diff --git a/app/views/stream_entries/_simple_status.html.haml b/app/views/stream_entries/_simple_status.html.haml index 88700543d..a227467f0 100644 --- a/app/views/stream_entries/_simple_status.html.haml +++ b/app/views/stream_entries/_simple_status.html.haml @@ -18,19 +18,11 @@ %p{ style: 'margin-bottom: 0' }< %span.p-summary> #{Formatter.instance.format_spoiler(status)}  %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more') - .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }< - = Formatter.instance.format(status) + .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status, custom_emojify: true) - unless status.media_attachments.empty? - .status__attachments>< - = render partial: 'stream_entries/content_spoiler', locals: { sensitive: status.sensitive? } - - if status.media_attachments.first.video? - .status__attachments__inner< - .video-item< - = link_to (status.media_attachments.first.remote_url.blank? ? status.media_attachments.first.file.url(:original) : status.media_attachments.first.remote_url), style: "background-image: url(#{status.media_attachments.first.file.url(:small)})", target: '_blank', rel: 'noopener', class: 'u-video' do - .video-item__play - = fa_icon('play') - - else - .status__attachments__inner< - - status.media_attachments.each do |media| - = render partial: 'stream_entries/media', locals: { media: media } + - if status.media_attachments.first.video? + - video = status.media_attachments.first + %div{ data: { component: 'Video', props: Oj.dump(src: video.file.url(:original), preview: video.file.url(:small), sensitive: status.sensitive?, width: 610, height: 343) }}>< + - else + %div{ data: { component: 'MediaGallery', props: Oj.dump(height: 343, sensitive: status.sensitive?, 'autoPlayGif': current_account&.user&.setting_auto_play_gif, media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json }) }}>< -- cgit From cf1f83ca2a35247184f1f27607960c21a37398ea Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 28 Sep 2017 17:45:16 -0700 Subject: Fixed lingering upstream Theme code --- app/views/layouts/error.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/views/layouts/error.html.haml b/app/views/layouts/error.html.haml index 31f322096..8b260c619 100644 --- a/app/views/layouts/error.html.haml +++ b/app/views/layouts/error.html.haml @@ -6,7 +6,7 @@ %title= safe_join([yield(:page_title), title], ' - ') %meta{ content: 'width=device-width,initial-scale=1', name: 'viewport' }/ = stylesheet_pack_tag 'common', media: 'all' - = stylesheet_pack_tag Setting.default_settings['theme'], media: 'all' + = stylesheet_pack_tag 'application', integrity: true, media: 'all' %body.error .dialog %img{ alt: title, src: '/oops.gif' }/ -- cgit From 53f829dfa8bc376041a442dc84c22aa1cbfcb9d0 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 28 Sep 2017 18:16:04 -0700 Subject: HAML fix --- app/views/stream_entries/_detailed_status.html.haml | 3 ++- app/views/stream_entries/_simple_status.html.haml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'app/views') diff --git a/app/views/stream_entries/_detailed_status.html.haml b/app/views/stream_entries/_detailed_status.html.haml index a839b4898..9a26d2c0b 100644 --- a/app/views/stream_entries/_detailed_status.html.haml +++ b/app/views/stream_entries/_detailed_status.html.haml @@ -17,7 +17,8 @@ %p{ style: 'margin-bottom: 0' }< %span.p-summary> #{Formatter.instance.format_spoiler(status)}  %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more') - .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status, custom_emojify: true) + .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" } + = Formatter.instance.format(status, custom_emojify: true) - if !status.media_attachments.empty? - if status.media_attachments.first.video? diff --git a/app/views/stream_entries/_simple_status.html.haml b/app/views/stream_entries/_simple_status.html.haml index a227467f0..9a2524219 100644 --- a/app/views/stream_entries/_simple_status.html.haml +++ b/app/views/stream_entries/_simple_status.html.haml @@ -18,7 +18,8 @@ %p{ style: 'margin-bottom: 0' }< %span.p-summary> #{Formatter.instance.format_spoiler(status)}  %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more') - .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status, custom_emojify: true) + .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" } + = Formatter.instance.format(status, custom_emojify: true) - unless status.media_attachments.empty? - if status.media_attachments.first.video? -- cgit From ce3e0faf4d262ce28d4f0aed711d6bedb2c7db5c Mon Sep 17 00:00:00 2001 From: Ondřej Hruška Date: Fri, 29 Sep 2017 16:41:18 +0200 Subject: add login form to landing page if regs are closed --- app/views/about/show.html.haml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/views') diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml index 737dbbcef..c0fa944ae 100644 --- a/app/views/about/show.html.haml +++ b/app/views/about/show.html.haml @@ -47,6 +47,13 @@ %p= t('about.closed_registrations') - else = @instance_presenter.closed_registrations_message.html_safe + + = simple_form_for(:user, html: { style: 'margin-left: -20px' }, url: session_path(:user)) do |f| + = f.input :email, autofocus: true, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') } + = f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off' } + + .actions + = f.button :button, t('auth.login'), type: :submit = link_to t('about.find_another_instance'), 'https://joinmastodon.org/', class: 'button button-alternative button--block' .about-short -- cgit From 6610d57f91a5e2a2f862a20eaaca76a5c8efe1e2 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Fri, 6 Oct 2017 22:22:34 -0700 Subject: Basic static metadata styling --- app/javascript/styles/accounts.scss | 25 +++++++++++++++++++++++++ app/views/accounts/_header.html.haml | 8 ++++---- 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'app/views') diff --git a/app/javascript/styles/accounts.scss b/app/javascript/styles/accounts.scss index 744650554..b51761de1 100644 --- a/app/javascript/styles/accounts.scss +++ b/app/javascript/styles/accounts.scss @@ -203,6 +203,31 @@ color: $ui-secondary-color; } + .metadata { + margin: 15px 0; + border: thin $ui-base-color solid; + border-collapse: collapse; + padding: 0; + + th { + margin: 0; + border: thin $ui-base-color solid; + padding: 0 5px; + color: $ui-secondary-color; + background: darken($ui-base-color, 8%); + width: 94px; + vertical-align: middle; + } + + td { + margin: 0; + border: thin $ui-base-color solid; + padding: 0 5px; + color: $ui-primary-color; + vertical-align: middle; + } + } + @media screen and (max-width: 480px) { display: block; diff --git a/app/views/accounts/_header.html.haml b/app/views/accounts/_header.html.haml index dcc6661ba..5b504912d 100644 --- a/app/views/accounts/_header.html.haml +++ b/app/views/accounts/_header.html.haml @@ -34,11 +34,11 @@ .bio .account__header__content.p-note.emojify!=processed_bio[:text] - if processed_bio[:metadata].length > 0 - .metadata< + %table.metadata< - processed_bio[:metadata].each do |i| - .metadata-item>< - %b.emojify>!=i[0] - %span.emojify>!=i[1] + %tr.metadata-item>< + %th.emojify>!=i[0] + %td.emojify>!=i[1] .details-counters .counter{ class: active_nav_class(short_account_url(account)) } -- cgit From bd51a16150593f79631164fc75b3d289f861b74c Mon Sep 17 00:00:00 2001 From: Ondřej Hruška Date: Wed, 11 Oct 2017 21:34:00 +0200 Subject: add duck beaks in haml --- app/views/stream_entries/_detailed_status.html.haml | 2 +- app/views/stream_entries/_simple_status.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app/views') diff --git a/app/views/stream_entries/_detailed_status.html.haml b/app/views/stream_entries/_detailed_status.html.haml index 9a26d2c0b..a4eab16df 100644 --- a/app/views/stream_entries/_detailed_status.html.haml +++ b/app/views/stream_entries/_detailed_status.html.haml @@ -17,7 +17,7 @@ %p{ style: 'margin-bottom: 0' }< %span.p-summary> #{Formatter.instance.format_spoiler(status)}  %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more') - .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" } + .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }< = Formatter.instance.format(status, custom_emojify: true) - if !status.media_attachments.empty? diff --git a/app/views/stream_entries/_simple_status.html.haml b/app/views/stream_entries/_simple_status.html.haml index 9a2524219..0b45ff308 100644 --- a/app/views/stream_entries/_simple_status.html.haml +++ b/app/views/stream_entries/_simple_status.html.haml @@ -18,7 +18,7 @@ %p{ style: 'margin-bottom: 0' }< %span.p-summary> #{Formatter.instance.format_spoiler(status)}  %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more') - .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" } + .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }< = Formatter.instance.format(status, custom_emojify: true) - unless status.media_attachments.empty? -- cgit From 4fa2f7e82d68c974ecfdb8896f15a5a3aba25828 Mon Sep 17 00:00:00 2001 From: David Yip Date: Sun, 15 Oct 2017 03:17:33 -0500 Subject: Set up /settings/keyword_mutes. #164. This should eventually be accessible via the API and the web frontend, but I find it easier to set up an editing interface using Rails templates and the like. We can always take it out if it turns out we don't need it. --- app/controllers/settings/keyword_mutes_controller.rb | 7 +++++++ app/helpers/settings/keyword_mutes_helper.rb | 2 ++ app/views/settings/keyword_mutes/index.html.haml | 2 ++ config/locales/en.yml | 1 + config/navigation.rb | 1 + config/routes.rb | 1 + .../controllers/settings/keyword_mutes_controller_spec.rb | 5 +++++ spec/helpers/settings/keyword_mutes_helper_spec.rb | 15 +++++++++++++++ 8 files changed, 34 insertions(+) create mode 100644 app/controllers/settings/keyword_mutes_controller.rb create mode 100644 app/helpers/settings/keyword_mutes_helper.rb create mode 100644 app/views/settings/keyword_mutes/index.html.haml create mode 100644 spec/controllers/settings/keyword_mutes_controller_spec.rb create mode 100644 spec/helpers/settings/keyword_mutes_helper_spec.rb (limited to 'app/views') diff --git a/app/controllers/settings/keyword_mutes_controller.rb b/app/controllers/settings/keyword_mutes_controller.rb new file mode 100644 index 000000000..ffe94e33a --- /dev/null +++ b/app/controllers/settings/keyword_mutes_controller.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class Settings::KeywordMutesController < ApplicationController + layout 'admin' + + before_action :authenticate_user! +end diff --git a/app/helpers/settings/keyword_mutes_helper.rb b/app/helpers/settings/keyword_mutes_helper.rb new file mode 100644 index 000000000..7b98cd59e --- /dev/null +++ b/app/helpers/settings/keyword_mutes_helper.rb @@ -0,0 +1,2 @@ +module Settings::KeywordMutesHelper +end diff --git a/app/views/settings/keyword_mutes/index.html.haml b/app/views/settings/keyword_mutes/index.html.haml new file mode 100644 index 000000000..421fbeba2 --- /dev/null +++ b/app/views/settings/keyword_mutes/index.html.haml @@ -0,0 +1,2 @@ +- content_for :page_title do + = t('settings.keyword_mutes') diff --git a/config/locales/en.yml b/config/locales/en.yml index 45929e97d..6b4e602bd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -491,6 +491,7 @@ en: export: Data export followers: Authorized followers import: Import + keyword_mutes: Muted keywords notifications: Notifications preferences: Preferences settings: Settings diff --git a/config/navigation.rb b/config/navigation.rb index 50bfbd480..9fa029b72 100644 --- a/config/navigation.rb +++ b/config/navigation.rb @@ -7,6 +7,7 @@ SimpleNavigation::Configuration.run do |navigation| primary.item :settings, safe_join([fa_icon('cog fw'), t('settings.settings')]), settings_profile_url do |settings| settings.item :profile, safe_join([fa_icon('user fw'), t('settings.edit_profile')]), settings_profile_url settings.item :preferences, safe_join([fa_icon('sliders fw'), t('settings.preferences')]), settings_preferences_url + settings.item :keyword_mutes, safe_join([fa_icon('volume-off fw'), t('settings.keyword_mutes')]), settings_keyword_mutes_url settings.item :notifications, safe_join([fa_icon('bell fw'), t('settings.notifications')]), settings_notifications_url settings.item :password, safe_join([fa_icon('lock fw'), t('auth.change_password')]), edit_user_registration_url, highlights_on: %r{/auth/edit|/settings/delete} settings.item :two_factor_authentication, safe_join([fa_icon('mobile fw'), t('settings.two_factor_authentication')]), settings_two_factor_authentication_url, highlights_on: %r{/settings/two_factor_authentication} diff --git a/config/routes.rb b/config/routes.rb index 9ed081e50..686914239 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -66,6 +66,7 @@ Rails.application.routes.draw do namespace :settings do resource :profile, only: [:show, :update] + resources :keyword_mutes resource :preferences, only: [:show, :update] resource :notifications, only: [:show, :update] resource :import, only: [:show, :create] diff --git a/spec/controllers/settings/keyword_mutes_controller_spec.rb b/spec/controllers/settings/keyword_mutes_controller_spec.rb new file mode 100644 index 000000000..a8c37a072 --- /dev/null +++ b/spec/controllers/settings/keyword_mutes_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Settings::KeywordMutesController, type: :controller do + +end diff --git a/spec/helpers/settings/keyword_mutes_helper_spec.rb b/spec/helpers/settings/keyword_mutes_helper_spec.rb new file mode 100644 index 000000000..a19d518dd --- /dev/null +++ b/spec/helpers/settings/keyword_mutes_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Settings::KeywordMutesHelper. For example: +# +# describe Settings::KeywordMutesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Settings::KeywordMutesHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end -- cgit From 2e03a10059889cb05d4fab7736447a4315f90bf5 Mon Sep 17 00:00:00 2001 From: David Yip Date: Sun, 15 Oct 2017 04:51:42 -0500 Subject: Spike out index and new views for keyword mutes controller. --- .../settings/keyword_mutes_controller.rb | 23 ++++++++++++++++++++++ .../settings/keyword_mutes/_keyword_mute.html.haml | 7 +++++++ app/views/settings/keyword_mutes/index.html.haml | 13 ++++++++++++ app/views/settings/keyword_mutes/new.html.haml | 19 ++++++++++++++++++ config/locales/en.yml | 5 +++++ 5 files changed, 67 insertions(+) create mode 100644 app/views/settings/keyword_mutes/_keyword_mute.html.haml create mode 100644 app/views/settings/keyword_mutes/new.html.haml (limited to 'app/views') diff --git a/app/controllers/settings/keyword_mutes_controller.rb b/app/controllers/settings/keyword_mutes_controller.rb index ffe94e33a..4b3e01b9c 100644 --- a/app/controllers/settings/keyword_mutes_controller.rb +++ b/app/controllers/settings/keyword_mutes_controller.rb @@ -4,4 +4,27 @@ class Settings::KeywordMutesController < ApplicationController layout 'admin' before_action :authenticate_user! + before_action :set_account + + def index + @keyword_mutes = paginated_keyword_mutes_for_account + end + + def new + @keyword_mute = keyword_mutes_for_account.build + end + + private + + def set_account + @account = current_user.account + end + + def keyword_mutes_for_account + KeywordMute.where(account: @account) + end + + def paginated_keyword_mutes_for_account + keyword_mutes_for_account.order(:keyword).page params[:page] + end end diff --git a/app/views/settings/keyword_mutes/_keyword_mute.html.haml b/app/views/settings/keyword_mutes/_keyword_mute.html.haml new file mode 100644 index 000000000..a2698ac7b --- /dev/null +++ b/app/views/settings/keyword_mutes/_keyword_mute.html.haml @@ -0,0 +1,7 @@ +%tr + %td + = keyword_mute.keyword + %td + = table_link_to 'edit', t('settings.keyword_mutes.edit'), edit_settings_keyword_mute_path(keyword_mute) + %td + = table_link_to 'times', t('settings.keyword_mutes.delete'), settings_keyword_mute_path(keyword_mute), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } diff --git a/app/views/settings/keyword_mutes/index.html.haml b/app/views/settings/keyword_mutes/index.html.haml index 421fbeba2..6b212895d 100644 --- a/app/views/settings/keyword_mutes/index.html.haml +++ b/app/views/settings/keyword_mutes/index.html.haml @@ -1,2 +1,15 @@ - content_for :page_title do = t('settings.keyword_mutes') + +.table-wrapper + %table.table + %thead + %tr + %th= t('settings.keyword_mutes.keyword') + %th + %th + %tbody + = render @keyword_mutes + += paginate @keyword_mutes += link_to t('settings.keyword_mutes.add_keyword'), new_settings_keyword_mute_path, class: 'button' diff --git a/app/views/settings/keyword_mutes/new.html.haml b/app/views/settings/keyword_mutes/new.html.haml new file mode 100644 index 000000000..5e8268e97 --- /dev/null +++ b/app/views/settings/keyword_mutes/new.html.haml @@ -0,0 +1,19 @@ +- content_for :page_title do + = t('settings.keyword_mutes.add_keyword') + += simple_form_for @keyword_mute, url: settings_keyword_mutes_path do |f| + = render 'shared/error_messages', object: @keyword_mute + + %p.muted-hint + Keywords match word boundaries case-insensitively. For example: + %ul + %li + alice matches alice, Alice, and Alice's + %li + bob matches bob and Bob but not bobcat + + .fields-group + = f.input :keyword + + .actions + = f.button :button, t('admin.keyword_mutes.add_keyword'), type: :submit diff --git a/config/locales/en.yml b/config/locales/en.yml index 6b4e602bd..5b91f8320 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -215,6 +215,11 @@ en: contact_information: email: Business e-mail username: Contact username + keyword_mutes: + edit: Edit + delete: Delete + add_keyword: Add keyword + keyword: Keyword registrations: closed_message: desc_html: Displayed on frontpage when registrations are closed. You can use HTML tags -- cgit From cd04e3df58c09b0faca81ccc820b2cd5e12c2890 Mon Sep 17 00:00:00 2001 From: David Yip Date: Fri, 20 Oct 2017 15:12:45 -0500 Subject: Fill in create, edit, update, and destroy for keyword mutes interface. Also add a destroy-all action, which can be useful if you're flushing an old list entirely to start a new one. --- .../settings/keyword_mutes_controller.rb | 42 ++++++++++++++++++++++ app/views/settings/keyword_mutes/_fields.html.haml | 11 ++++++ .../settings/keyword_mutes/_keyword_mute.html.haml | 3 ++ app/views/settings/keyword_mutes/edit.html.haml | 6 ++++ app/views/settings/keyword_mutes/index.html.haml | 7 ++-- app/views/settings/keyword_mutes/new.html.haml | 17 ++------- config/locales/en.yml | 13 ++++--- config/routes.rb | 8 ++++- 8 files changed, 84 insertions(+), 23 deletions(-) create mode 100644 app/views/settings/keyword_mutes/_fields.html.haml create mode 100644 app/views/settings/keyword_mutes/edit.html.haml (limited to 'app/views') diff --git a/app/controllers/settings/keyword_mutes_controller.rb b/app/controllers/settings/keyword_mutes_controller.rb index 4b3e01b9c..d9f99af09 100644 --- a/app/controllers/settings/keyword_mutes_controller.rb +++ b/app/controllers/settings/keyword_mutes_controller.rb @@ -5,6 +5,7 @@ class Settings::KeywordMutesController < ApplicationController before_action :authenticate_user! before_action :set_account + before_action :load_keyword_mute, only: [:edit, :update, :destroy] def index @keyword_mutes = paginated_keyword_mutes_for_account @@ -14,6 +15,39 @@ class Settings::KeywordMutesController < ApplicationController @keyword_mute = keyword_mutes_for_account.build end + def create + @keyword_mute = keyword_mutes_for_account.create(keyword_mute_params) + + if @keyword_mute.persisted? + redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg') + else + render :new + end + end + + def update + if @keyword_mute.update(keyword_mute_params) + redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg') + else + render :new + end + end + + def destroy + if @keyword_mute.destroy + redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg') + else + # FIXME + redirect_to settings_keyword_mutes_path, notice: "huh that didn't work right" + end + end + + def destroy_all + keyword_mutes_for_account.delete_all + + redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg') + end + private def set_account @@ -24,6 +58,14 @@ class Settings::KeywordMutesController < ApplicationController KeywordMute.where(account: @account) end + def load_keyword_mute + @keyword_mute = keyword_mutes_for_account.find(params[:id]) + end + + def keyword_mute_params + params.require(:keyword_mute).permit(:keyword, :whole_word) + end + def paginated_keyword_mutes_for_account keyword_mutes_for_account.order(:keyword).page params[:page] end diff --git a/app/views/settings/keyword_mutes/_fields.html.haml b/app/views/settings/keyword_mutes/_fields.html.haml new file mode 100644 index 000000000..892676f18 --- /dev/null +++ b/app/views/settings/keyword_mutes/_fields.html.haml @@ -0,0 +1,11 @@ +.fields-group + = f.input :keyword + = f.check_box :whole_word + = f.label :whole_word, t('keyword_mutes.match_whole_word') + +.actions + - if f.object.persisted? + = f.button :button, t('generic.save_changes'), type: :submit + = link_to t('keyword_mutes.remove'), settings_keyword_mute_path(f.object), class: 'negative button', method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } + - else + = f.button :button, t('keyword_mutes.add_keyword'), type: :submit diff --git a/app/views/settings/keyword_mutes/_keyword_mute.html.haml b/app/views/settings/keyword_mutes/_keyword_mute.html.haml index a2698ac7b..7e191d79b 100644 --- a/app/views/settings/keyword_mutes/_keyword_mute.html.haml +++ b/app/views/settings/keyword_mutes/_keyword_mute.html.haml @@ -1,6 +1,9 @@ %tr %td = keyword_mute.keyword + %td + - if keyword_mute.whole_word + %i.fa.fa-check %td = table_link_to 'edit', t('settings.keyword_mutes.edit'), edit_settings_keyword_mute_path(keyword_mute) %td diff --git a/app/views/settings/keyword_mutes/edit.html.haml b/app/views/settings/keyword_mutes/edit.html.haml new file mode 100644 index 000000000..2b52f4018 --- /dev/null +++ b/app/views/settings/keyword_mutes/edit.html.haml @@ -0,0 +1,6 @@ +- content_for :page_title do + = t('keyword_mutes.edit_keyword') + += simple_form_for @keyword_mute, url: settings_keyword_mute_path(@keyword_mute) do |f| + = render 'shared/error_messages', object: @keyword_mute + = render 'fields', f: f diff --git a/app/views/settings/keyword_mutes/index.html.haml b/app/views/settings/keyword_mutes/index.html.haml index 6b212895d..b359eea4a 100644 --- a/app/views/settings/keyword_mutes/index.html.haml +++ b/app/views/settings/keyword_mutes/index.html.haml @@ -5,11 +5,14 @@ %table.table %thead %tr - %th= t('settings.keyword_mutes.keyword') + %th= t('keyword_mutes.keyword') + %th= t('keyword_mutes.match_whole_word') %th %th %tbody = render @keyword_mutes = paginate @keyword_mutes -= link_to t('settings.keyword_mutes.add_keyword'), new_settings_keyword_mute_path, class: 'button' +.simple_form + = link_to t('keyword_mutes.add_keyword'), new_settings_keyword_mute_path, class: 'button' + = link_to t('keyword_mutes.remove_all'), destroy_all_settings_keyword_mutes_path, class: 'button negative', method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } diff --git a/app/views/settings/keyword_mutes/new.html.haml b/app/views/settings/keyword_mutes/new.html.haml index 5e8268e97..197f10cd7 100644 --- a/app/views/settings/keyword_mutes/new.html.haml +++ b/app/views/settings/keyword_mutes/new.html.haml @@ -1,19 +1,6 @@ - content_for :page_title do - = t('settings.keyword_mutes.add_keyword') + = t('keyword_mutes.add_keyword') = simple_form_for @keyword_mute, url: settings_keyword_mutes_path do |f| = render 'shared/error_messages', object: @keyword_mute - - %p.muted-hint - Keywords match word boundaries case-insensitively. For example: - %ul - %li - alice matches alice, Alice, and Alice's - %li - bob matches bob and Bob but not bobcat - - .fields-group - = f.input :keyword - - .actions - = f.button :button, t('admin.keyword_mutes.add_keyword'), type: :submit + = render 'fields', f: f diff --git a/config/locales/en.yml b/config/locales/en.yml index 5b91f8320..22aa29be3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -215,11 +215,6 @@ en: contact_information: email: Business e-mail username: Contact username - keyword_mutes: - edit: Edit - delete: Delete - add_keyword: Add keyword - keyword: Keyword registrations: closed_message: desc_html: Displayed on frontpage when registrations are closed. You can use HTML tags @@ -378,6 +373,14 @@ en: following: Following list muting: Muting list upload: Upload + keyword_mutes: + add_keyword: Add keyword + delete: Delete + edit: Edit + edit_keyword: Edit keyword + keyword: Keyword + match_whole_word: Match whole word + remove_all: Remove all landing_strip_html: "%{name} is a user on %{link_to_root_path}. You can follow them or interact with them if you have an account anywhere in the fediverse." landing_strip_signup_html: If you don't, you can sign up here. media_attachments: diff --git a/config/routes.rb b/config/routes.rb index 686914239..5d83ef2ab 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -66,7 +66,13 @@ Rails.application.routes.draw do namespace :settings do resource :profile, only: [:show, :update] - resources :keyword_mutes + + resources :keyword_mutes do + collection do + delete :destroy_all + end + end + resource :preferences, only: [:show, :update] resource :notifications, only: [:show, :update] resource :import, only: [:show, :create] -- cgit From 1a60445a5fa8208b54afaedf5e5796fb2ac0a80a Mon Sep 17 00:00:00 2001 From: David Yip Date: Sun, 22 Oct 2017 01:05:56 -0500 Subject: Address unused translation errors. --- app/views/settings/keyword_mutes/_keyword_mute.html.haml | 4 ++-- config/locales/en.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app/views') diff --git a/app/views/settings/keyword_mutes/_keyword_mute.html.haml b/app/views/settings/keyword_mutes/_keyword_mute.html.haml index 7e191d79b..c45cc64fb 100644 --- a/app/views/settings/keyword_mutes/_keyword_mute.html.haml +++ b/app/views/settings/keyword_mutes/_keyword_mute.html.haml @@ -5,6 +5,6 @@ - if keyword_mute.whole_word %i.fa.fa-check %td - = table_link_to 'edit', t('settings.keyword_mutes.edit'), edit_settings_keyword_mute_path(keyword_mute) + = table_link_to 'edit', t('keyword_mutes.edit'), edit_settings_keyword_mute_path(keyword_mute) %td - = table_link_to 'times', t('settings.keyword_mutes.delete'), settings_keyword_mute_path(keyword_mute), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } + = table_link_to 'times', t('keyword_mutes.remove'), settings_keyword_mute_path(keyword_mute), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } diff --git a/config/locales/en.yml b/config/locales/en.yml index 22aa29be3..7d46df327 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -375,11 +375,11 @@ en: upload: Upload keyword_mutes: add_keyword: Add keyword - delete: Delete edit: Edit edit_keyword: Edit keyword keyword: Keyword match_whole_word: Match whole word + remove: Remove remove_all: Remove all landing_strip_html: "%{name} is a user on %{link_to_root_path}. You can follow them or interact with them if you have an account anywhere in the fediverse." landing_strip_signup_html: If you don't, you can sign up here. -- cgit From a76b02422847c5d5996c03284f3dd5e662bbfb9d Mon Sep 17 00:00:00 2001 From: Matthew Walsh Date: Sun, 22 Oct 2017 18:45:35 -0700 Subject: Changes to match other timelines in 2.0 --- app/javascript/mastodon/actions/compose.js | 3 ++- app/javascript/mastodon/features/ui/index.js | 6 ++++++ app/views/home/index.html.haml | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index 278fbc898..25fb1aa83 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -8,6 +8,7 @@ import { refreshHomeTimeline, refreshCommunityTimeline, refreshPublicTimeline, + refreshDirectTimeline, } from './timelines'; export const COMPOSE_CHANGE = 'COMPOSE_CHANGE'; @@ -129,7 +130,7 @@ export function submitCompose() { insertOrRefresh('community', refreshCommunityTimeline); insertOrRefresh('public', refreshPublicTimeline); } else if (response.data.visibility === 'direct') { - dispatch(updateTimeline('direct', { ...response.data })); + insertOrRefresh('direct', refreshDirectTimeline); } }).catch(function (error) { dispatch(submitComposeFail(error)); diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js index cf51f0fb6..a0f5a86b0 100644 --- a/app/javascript/mastodon/features/ui/index.js +++ b/app/javascript/mastodon/features/ui/index.js @@ -67,6 +67,7 @@ const keyMap = { goToNotifications: 'g n', goToLocal: 'g l', goToFederated: 'g t', + goToDirect: 'g d', goToStart: 'g s', goToFavourites: 'g f', goToPinned: 'g p', @@ -293,6 +294,10 @@ export default class UI extends React.Component { this.context.router.history.push('/timelines/public'); } + handleHotkeyGoToDirect = () => { + this.context.router.history.push('/timelines/direct'); + } + handleHotkeyGoToStart = () => { this.context.router.history.push('/getting-started'); } @@ -331,6 +336,7 @@ export default class UI extends React.Component { goToNotifications: this.handleHotkeyGoToNotifications, goToLocal: this.handleHotkeyGoToLocal, goToFederated: this.handleHotkeyGoToFederated, + goToDirect: this.handleHotkeyGoToDirect, goToStart: this.handleHotkeyGoToStart, goToFavourites: this.handleHotkeyGoToFavourites, goToPinned: this.handleHotkeyGoToPinned, diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 659295ebf..6a3e5f324 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -5,6 +5,7 @@ %link{ href: asset_pack_path('features/notifications.js'), crossorigin: 'anonymous', rel: 'preload', as: 'script' }/ %link{ href: asset_pack_path('features/community_timeline.js'), crossorigin: 'anonymous', rel: 'preload', as: 'script' }/ %link{ href: asset_pack_path('features/public_timeline.js'), crossorigin: 'anonymous', rel: 'preload', as: 'script' }/ + %link{ href: asset_pack_path('features/direct_timeline.js'), crossorigin: 'anonymous', rel: 'preload', as: 'script' }/ %meta{name: 'applicationServerKey', content: Rails.configuration.x.vapid_public_key} %script#initial-state{ type: 'application/json' }!= json_escape(@initial_state_json) -- cgit From 9226257a1b43727d61f78621ff7eaadbe37c8fda Mon Sep 17 00:00:00 2001 From: David Yip Date: Tue, 24 Oct 2017 18:40:28 -0500 Subject: Override Action View name inference in settings/keyword_mutes. Glitch::KeywordMute's name is inferred as glitch_keyword_mutes, and in templates this turns into e.g. settings/glitch/keyword_mutes. Going along with this convention means a lot of file movement, though, and for a UI that's as temporary and awkward as this one I think it's less effort to slap a bunch of as: options everywhere. We'll do the Right Thing when we build out the API and frontend UI. --- app/views/settings/keyword_mutes/edit.html.haml | 2 +- app/views/settings/keyword_mutes/index.html.haml | 2 +- app/views/settings/keyword_mutes/new.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app/views') diff --git a/app/views/settings/keyword_mutes/edit.html.haml b/app/views/settings/keyword_mutes/edit.html.haml index 2b52f4018..af3949be2 100644 --- a/app/views/settings/keyword_mutes/edit.html.haml +++ b/app/views/settings/keyword_mutes/edit.html.haml @@ -1,6 +1,6 @@ - content_for :page_title do = t('keyword_mutes.edit_keyword') -= simple_form_for @keyword_mute, url: settings_keyword_mute_path(@keyword_mute) do |f| += simple_form_for @keyword_mute, url: settings_keyword_mute_path(@keyword_mute), as: :keyword_mute do |f| = render 'shared/error_messages', object: @keyword_mute = render 'fields', f: f diff --git a/app/views/settings/keyword_mutes/index.html.haml b/app/views/settings/keyword_mutes/index.html.haml index b359eea4a..9ef8d55bc 100644 --- a/app/views/settings/keyword_mutes/index.html.haml +++ b/app/views/settings/keyword_mutes/index.html.haml @@ -10,7 +10,7 @@ %th %th %tbody - = render @keyword_mutes + = render partial: 'keyword_mute', collection: @keyword_mutes, as: :keyword_mute = paginate @keyword_mutes .simple_form diff --git a/app/views/settings/keyword_mutes/new.html.haml b/app/views/settings/keyword_mutes/new.html.haml index 197f10cd7..5c999c8d2 100644 --- a/app/views/settings/keyword_mutes/new.html.haml +++ b/app/views/settings/keyword_mutes/new.html.haml @@ -1,6 +1,6 @@ - content_for :page_title do = t('keyword_mutes.add_keyword') -= simple_form_for @keyword_mute, url: settings_keyword_mutes_path do |f| += simple_form_for @keyword_mute, url: settings_keyword_mutes_path, as: :keyword_mute do |f| = render 'shared/error_messages', object: @keyword_mute = render 'fields', f: f -- cgit